]> git.ipfire.org Git - thirdparty/util-linux.git/blob - bash-completion/nsenter
rev: be careful with close()
[thirdparty/util-linux.git] / bash-completion / nsenter
1 _nsenter_module()
2 {
3 local cur prev OPTS
4 COMPREPLY=()
5 cur="${COMP_WORDS[COMP_CWORD]}"
6 prev="${COMP_WORDS[COMP_CWORD-1]}"
7 case $prev in
8 '-S'|'--uid')
9 COMPREPLY=( $(compgen -W "uid" -- $cur) )
10 return 0
11 ;;
12 '-G'|'--gid')
13 COMPREPLY=( $(compgen -W "gid" -- $cur) )
14 return 0
15 ;;
16 '-t'|'--target')
17 local PIDS
18 PIDS=$(cd /proc && echo [0-9]*)
19 COMPREPLY=( $(compgen -W "$PIDS" -- $cur) )
20 return 0
21 ;;
22 '-h'|'--help'|'-V'|'--version')
23 return 0
24 ;;
25 esac
26 case $cur in
27 '=')
28 # FIXME: --root and --wd should use get only
29 # directories as compgen output. If $cur is
30 # overwrote the same way as below in case segment
31 # for $prev the command-line will get mangled.
32 cur=${cur#=}
33 ;;
34 -*)
35 OPTS="
36 --all
37 --target
38 --mount=
39 --uts=
40 --ipc=
41 --net=
42 --pid=
43 --cgroup=
44 --user=
45 --setuid
46 --setgid
47 --preserve-credentials
48 --root=
49 --wd=
50 --no-fork
51 --help
52 --version
53 "
54 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
55 return 0
56 ;;
57 esac
58 local IFS=$'\n'
59 compopt -o filenames
60 COMPREPLY=( $(compgen -f -- $cur) )
61 return 0
62 }
63 complete -F _nsenter_module nsenter