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 b3dc049..c04f23f 100644 (file)
@@ -510,7 +510,7 @@ gsu_cword_is_option_parameter()
                opt="${opts:$i:1}"
                [[ "${opts:$(($i + 1)):1}" != ":" ]] && continue
                let i++
-               [[ "$prev" != "-$opt" ]] && continue
+               [[ ! "$prev" =~ ^-.*$opt$ ]] && continue
                result="$opt"
                return
        done