Browse Source

Also suggest short options

Alois Mahdal 7 years ago
parent
commit
69d96ade04
1 changed files with 7 additions and 1 deletions
  1. 7
    1
      src/complete.bash

+ 7
- 1
src/complete.bash View File

1
 #!/bin/bash
1
 #!/bin/bash
2
 
2
 
3
 __satcmd() {
3
 __satcmd() {
4
-    local cur opts
4
+    local cur opts sopts
5
     COMPREPLY=()
5
     COMPREPLY=()
6
     cur="${COMP_WORDS[COMP_CWORD]}"
6
     cur="${COMP_WORDS[COMP_CWORD]}"
7
+    sopts="-d -h -v"
7
     opts="--help --verbose --debug --version --version-semver"
8
     opts="--help --verbose --debug --version --version-semver"
8
 
9
 
9
     case "$cur" in
10
     case "$cur" in
11
+        -*)
12
+            COMPREPLY=(
13
+                $(compgen -W "$sopts $opts" -- "${cur}")
14
+            )
15
+            ;;
10
         --*)
16
         --*)
11
             COMPREPLY=(
17
             COMPREPLY=(
12
                 $(compgen -W "$opts" -- "${cur}")
18
                 $(compgen -W "$opts" -- "${cur}")