]>
Commit | Line | Data |
---|---|---|
483baa35 MY |
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 | |
69dee227 SK |
8 | '-o'|'--output') |
9 | local prefix realcur OUTPUT_ALL OUTPUT | |
10 | realcur="${cur##*,}" | |
11 | prefix="${cur%$realcur}" | |
1ab3f16b | 12 | OUTPUT_ALL='PAGES SIZE FILE RES' |
69dee227 SK |
13 | for WORD in $OUTPUT_ALL; do |
14 | if ! [[ $prefix == *"$WORD"* ]]; then | |
abbcec4f | 15 | OUTPUT="$WORD ${OUTPUT:-""}" |
69dee227 SK |
16 | fi |
17 | done | |
18 | compopt -o nospace | |
19 | COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- "$realcur") ) | |
20 | return 0 | |
21 | ;; | |
483baa35 MY |
22 | '-h'|'--help'|'-V'|'--version') |
23 | return 0 | |
24 | ;; | |
25 | esac | |
26 | case $cur in | |
27 | -*) | |
69dee227 SK |
28 | OPTS=" |
29 | --json | |
30 | --bytes | |
31 | --noheadings | |
32 | --output | |
33 | --raw | |
34 | --help | |
35 | --version | |
36 | " | |
483baa35 MY |
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 |