]> git.ipfire.org Git - thirdparty/util-linux.git/blob - bash-completion/fincore
Merge branch 'PR/libsmartcols-reduce-fix' of github.com:karelzak/util-linux-work
[thirdparty/util-linux.git] / bash-completion / fincore
1 _fincore_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 '-o'|'--output')
9 local prefix realcur OUTPUT_ALL OUTPUT
10 realcur="${cur##*,}"
11 prefix="${cur%$realcur}"
12 OUTPUT_ALL='PAGES SIZE FILE RES'
13 for WORD in $OUTPUT_ALL; do
14 if ! [[ $prefix == *"$WORD"* ]]; then
15 OUTPUT="$WORD ${OUTPUT:-""}"
16 fi
17 done
18 compopt -o nospace
19 COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- "$realcur") )
20 return 0
21 ;;
22 '-h'|'--help'|'-V'|'--version')
23 return 0
24 ;;
25 esac
26 case $cur in
27 -*)
28 OPTS="
29 --json
30 --bytes
31 --noheadings
32 --output
33 --raw
34 --help
35 --version
36 "
37 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
38 return 0
39 ;;
40 esac
41 local IFS=$'\n'
42 compopt -o filenames
43 COMPREPLY=( $(compgen -f -- ${cur:-"/"}) )
44 return 0
45 }
46 complete -F _fincore_module fincore