aboutsummaryrefslogtreecommitdiffstats
path: root/src/bash_completion
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2015-08-18 16:27:57 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2015-08-18 16:27:57 -0400
commitea133564a732ee0299d8ce14d12481c448c5e2ae (patch)
tree4b2d5e6d4bbbf1f3ab01482ad23d77f333d10a4f /src/bash_completion
parentMerge pull request #32 from pmillerchip/tilde-support (diff)
downloadfirejail-ea133564a732ee0299d8ce14d12481c448c5e2ae.tar.gz
firejail-ea133564a732ee0299d8ce14d12481c448c5e2ae.tar.zst
firejail-ea133564a732ee0299d8ce14d12481c448c5e2ae.zip
moved bash completion files under src
Diffstat (limited to 'src/bash_completion')
-rw-r--r--src/bash_completion/firejail.bash_completion86
-rw-r--r--src/bash_completion/firemon.bash_completion39
2 files changed, 125 insertions, 0 deletions
diff --git a/src/bash_completion/firejail.bash_completion b/src/bash_completion/firejail.bash_completion
new file mode 100644
index 000000000..50eccf536
--- /dev/null
+++ b/src/bash_completion/firejail.bash_completion
@@ -0,0 +1,86 @@
1# bash completion for firejail -*- shell-script -*-
2#********************************************************************
3# Script based on completions/configure script in bash-completion package in
4# Debian. The original package is release under GPL v2 license, the webpage is
5# http://bash-completion.alioth.debian.org
6#*******************************************************************
7
8__interfaces(){
9 cut -f 1 -d ':' /proc/net/dev | tail -n +3 | grep -v lo | xargs
10}
11
12
13_firejail()
14{
15 local cur prev words cword split
16 _init_completion -s || return
17
18 case $prev in
19 --help|--version|-debug-caps|--debug-syscalls|--list|--tree|--top|--join|--shutdown)
20 return 0
21 ;;
22 --profile)
23 _filedir
24 return 0
25 ;;
26 --chroot)
27 _filedir -d
28 return 0
29 ;;
30 --cgroup)
31 _filedir -d
32 return 0
33 ;;
34 --tmpfs)
35 _filedir
36 return 0
37 ;;
38 --blacklist)
39 _filedir
40 return 0
41 ;;
42 --read-only)
43 _filedir
44 return 0
45 ;;
46 --bind)
47 _filedir
48 return 0
49 ;;
50 --private)
51 _filedir
52 return 0
53 ;;
54 --shell)
55 _filedir
56 return 0
57 ;;
58 --net)
59 comps=$(__interfaces)
60 COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
61 return 0
62 ;;
63 esac
64
65 $split && return 0
66
67 # if $COMP_CONFIGURE_HINTS is not null, then completions of the form
68 # --option=SETTING will include 'SETTING' as a contextual hint
69 [[ "$cur" != -* ]] && _filedir && return 0
70
71 if [[ -n $COMP_CONFIGURE_HINTS ]]; then
72 COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | \
73 awk '/^ --[A-Za-z]/ { print $1; \
74 if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,].*//g' )" \
75 -- "$cur" ) )
76 [[ $COMPREPLY == *=* ]] && compopt -o nospace
77 else
78 COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
79 [[ $COMPREPLY == *= ]] && compopt -o nospace
80 fi
81
82} &&
83complete -F _firejail firejail
84
85
86
diff --git a/src/bash_completion/firemon.bash_completion b/src/bash_completion/firemon.bash_completion
new file mode 100644
index 000000000..befbf2388
--- /dev/null
+++ b/src/bash_completion/firemon.bash_completion
@@ -0,0 +1,39 @@
1# bash completion for firemon -*- shell-script -*-
2#********************************************************************
3# Script based on completions/configure script in bash-completion package in
4# Debian. The original package is release under GPL v2 license, the webpage is
5# http://bash-completion.alioth.debian.org
6#*******************************************************************
7
8_firemon()
9{
10 local cur prev words cword split
11 _init_completion -s || return
12
13 case $prev in
14 --help|--version)
15 return
16 ;;
17 esac
18
19 $split && return 0
20
21 # if $COMP_CONFIGURE_HINTS is not null, then completions of the form
22 # --option=SETTING will include 'SETTING' as a contextual hint
23 [[ "$cur" != -* ]] && return 0
24
25 if [[ -n $COMP_CONFIGURE_HINTS ]]; then
26 COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | \
27 awk '/^ --[A-Za-z]/ { print $1; \
28 if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,].*//g' )" \
29 -- "$cur" ) )
30 [[ $COMPREPLY == *=* ]] && compopt -o nospace
31 else
32 COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
33 [[ $COMPREPLY == *= ]] && compopt -o nospace
34 fi
35} &&
36complete -F _firemon firemon
37
38
39