]>
Commit | Line | Data |
---|---|---|
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 |
86938d06 | 44 | --persistent |
07467647 SK |
45 | --task |
46 | --raw | |
47 | --notruncate | |
48 | --type | |
49 | --help | |
50 | --version | |
51 | " -- $cur) ) | |
52 | return 0 | |
53 | ;; | |
54 | esac | |
55 | COMPREPLY=( $(compgen -W "mnt net pid uts ipc user" -- $cur ) ) | |
56 | return 0 | |
57 | } | |
58 | complete -F _lsns_module lsns |