-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogpipe_autocomplete
More file actions
38 lines (35 loc) · 1.04 KB
/
progpipe_autocomplete
File metadata and controls
38 lines (35 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
_progpipe() {
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD - 1]}"
opts="--goal-num -g --field-sel -f --debug -d --test-mode -t --no-clear -c --message -m --verbose -v"
# Show help if no options are provided
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=($(compgen -W "$opts" -- "$cur"))
return 0
fi
case "${prev}" in
-g | --goal-num)
# Allow user to enter a number as the goal number
COMPREPLY=($(compgen -W "$(echo {0..9})" -- "$cur"))
return 0
;;
-f | --field-sel)
# Allow user to enter a number as the field selection
COMPREPLY=($(compgen -W "$(echo {1..9})" -- "$cur"))
return 0
;;
-m | --message)
# Allow user to enter any string as the message
COMPREPLY=($(compgen -W "" -- "$cur"))
return 0
;;
*)
# Complete options
COMPREPLY=($(compgen -W "$opts" -- "$cur"))
return 0
;;
esac
}
complete -F _progpipe progpipe