]> git.ipfire.org Git - thirdparty/util-linux.git/blame - bash-completion/lsns
rev: be careful with close()
[thirdparty/util-linux.git] / bash-completion / lsns
CommitLineData
07467647
SK
1_lsns_module()
2{
3 local cur prev OPTS LSNS_COLS_ALL
4 COMPREPLY=()
5 cur="${COMP_WORDS[COMP_CWORD]}"
6 prev="${COMP_WORDS[COMP_CWORD-1]}"
7 LSNS_COLS_ALL="
8 NS TYPE PATH NPROCS PID PPID COMMAND UID USER
9 "
10 case $prev in
11 '-o'|'--output')
12 local prefix realcur LSNS_COLS
13 realcur="${cur##*,}"
14 prefix="${cur%$realcur}"
15 for WORD in $LSNS_COLS_ALL; do
16 if ! [[ $prefix == *"$WORD"* ]]; then
c6f0bdfe 17 LSNS_COLS="$WORD ${LSNS_COLS:-""}"
07467647
SK
18 fi
19 done
20 compopt -o nospace
21 COMPREPLY=( $(compgen -P "$prefix" -W "$LSNS_COLS" -S ',' -- $realcur) )
22 return 0
23 ;;
24 '-p'|'--task')
25 COMPREPLY=( $(compgen -W "$(cd /proc && echo [0-9]*)" -- $cur) )
26 return 0
27 ;;
28 '-t'|'--type')
d092911b 29 COMPREPLY=( $(compgen -W "mnt net ipc user pid uts cgroup" -- $cur) )
07467647
SK
30 return 0
31 ;;
32 '-h'|'--help'|'-V'|'--version')
33 return 0
34 ;;
35 esac
36 case $cur in
37 -*)
38 COMPREPLY=( $(compgen -W "
39 --json
40 --list
41 --noheadings
42 --output
1f7b62e0 43 --output-all
07467647
SK
44 --task
45 --raw
46 --notruncate
47 --type
48 --help
49 --version
50 " -- $cur) )
51 return 0
52 ;;
53 esac
54 COMPREPLY=( $(compgen -W "mnt net pid uts ipc user" -- $cur ) )
55 return 0
56}
57complete -F _lsns_module lsns