[Bash-completion-commits] [bash-completion] 01/01: checksec: New completion

Ville Skyttä scop-guest at moszumanska.debian.org
Mon Jul 6 15:16:30 UTC 2015


This is an automated email from the git hooks/post-receive script.

scop-guest pushed a commit to branch master
in repository bash-completion.

commit ffd9038923aed3e8be6fe1c746ea3d41407cacb6
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Mon Jul 6 18:15:46 2015 +0300

    checksec: New completion
---
 completions/Makefile.am           |  1 +
 completions/checksec              | 37 +++++++++++++++++++++++++++++++++++++
 test/completion/checksec.exp      |  1 +
 test/lib/completions/checksec.exp | 18 ++++++++++++++++++
 4 files changed, 57 insertions(+)

diff --git a/completions/Makefile.am b/completions/Makefile.am
index d805b12..e3060c5 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -42,6 +42,7 @@ bashcomp_DATA = 2to3 \
 		change_pw \
 		check_db \
 		check_perms \
+		checksec \
 		_chfn \
 		chgrp \
 		chkconfig \
diff --git a/completions/checksec b/completions/checksec
new file mode 100644
index 0000000..cbd12ff
--- /dev/null
+++ b/completions/checksec
@@ -0,0 +1,37 @@
+# bash completion for checksec                             -*- shell-script -*-
+
+_checksec()
+{
+    local cur prev words cword
+    _init_completion || return
+
+    case $prev in
+        --version|--help)
+            return
+            ;;
+        --file|--fortify-file)
+            _filedir
+            return
+            ;;
+        --dir)
+            _filedir -d
+            return
+            ;;
+        --proc)
+            _pnames
+            return
+            ;;
+        --proc-libs|--fortify-proc)
+            _pids
+            return
+            ;;
+    esac
+
+    if [[ $cur == -* ]]; then
+        COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+        return
+    fi
+} &&
+complete -F _checksec checksec
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/test/completion/checksec.exp b/test/completion/checksec.exp
new file mode 100644
index 0000000..7e25e89
--- /dev/null
+++ b/test/completion/checksec.exp
@@ -0,0 +1 @@
+assert_source_completions checksec
diff --git a/test/lib/completions/checksec.exp b/test/lib/completions/checksec.exp
new file mode 100644
index 0000000..03abd57
--- /dev/null
+++ b/test/lib/completions/checksec.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+    save_env
+}
+
+
+proc teardown {} {
+    assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "checksec -"
+sync_after_int
+
+
+teardown

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/bash-completion/bash-completion.git



More information about the Bash-completion-commits mailing list