diff options
author | 2015-08-08 19:12:30 -0400 | |
---|---|---|
committer | 2015-08-08 19:12:30 -0400 | |
commit | 1379851360349d6617ad32944a25ee5e2bb74fc2 (patch) | |
tree | f69b48e90708bfa3c2723d5a27ed3e024c827b43 /etc/firejail.bash_completion | |
parent | delete files (diff) | |
download | firejail-1379851360349d6617ad32944a25ee5e2bb74fc2.tar.gz firejail-1379851360349d6617ad32944a25ee5e2bb74fc2.tar.zst firejail-1379851360349d6617ad32944a25ee5e2bb74fc2.zip |
Baseline firejail 0.9.28
Diffstat (limited to 'etc/firejail.bash_completion')
-rw-r--r-- | etc/firejail.bash_completion | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/etc/firejail.bash_completion b/etc/firejail.bash_completion new file mode 100644 index 000000000..50eccf536 --- /dev/null +++ b/etc/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 | } && | ||
83 | complete -F _firejail firejail | ||
84 | |||
85 | |||
86 | |||