Skip to content

Commit 517f301

Browse files
committed
Add bash completion for exercism opts
1 parent e98310f commit 517f301

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

shell/exercism_completion.bash

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,24 @@ _exercism () {
44
COMPREPLY=() # Array variable storing the possible completions.
55
cur=${COMP_WORDS[COMP_CWORD]}
66
prev=${COMP_WORDS[COMP_CWORD-1]}
7+
opts="--verbose --timeout"
78

89
commands="configure download open
910
submit troubleshoot upgrade version workspace help"
1011
config_opts="--show"
1112
version_opts="--latest"
1213

1314
if [ "${#COMP_WORDS[@]}" -eq 2 ]; then
14-
COMPREPLY=( $( compgen -W "${commands}" "${cur}" ) )
15-
return 0
15+
case "${cur}" in
16+
-*)
17+
COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) )
18+
return 0
19+
;;
20+
*)
21+
COMPREPLY=( $( compgen -W "${commands}" "${cur}" ) )
22+
return 0
23+
;;
24+
esac
1625
fi
1726

1827
if [ "${#COMP_WORDS[@]}" -eq 3 ]; then

0 commit comments

Comments
 (0)