]> git.tuebingen.mpg.de Git - gsu.git/commitdiff
Fix gsu_cword_is_option_parameter().
authorAndre Noll <maan@tuebingen.mpg.de>
Wed, 4 Oct 2017 15:27:01 +0000 (17:27 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 6 Nov 2017 11:27:40 +0000 (12:27 +0100)
The function did not recognize option combining. For example, the
current word was not recognized as an argument to -c if -c was given
as -abc. This patch should fix this issue.

subcommand

index b3dc0493905a2eb0a0bcb016bc99ed8e4799d981..c04f23feeb5ae018ce0e0ae1fea46efe20318b40 100644 (file)
@@ -510,7 +510,7 @@ gsu_cword_is_option_parameter()
                opt="${opts:$i:1}"
                [[ "${opts:$(($i + 1)):1}" != ":" ]] && continue
                let i++
                opt="${opts:$i:1}"
                [[ "${opts:$(($i + 1)):1}" != ":" ]] && continue
                let i++
-               [[ "$prev" != "-$opt" ]] && continue
+               [[ ! "$prev" =~ ^-.*$opt$ ]] && continue
                result="$opt"
                return
        done
                result="$opt"
                return
        done