diff --git a/completion.go b/completion.go index dc6a447..8ed61f1 100644 --- a/completion.go +++ b/completion.go @@ -188,8 +188,8 @@ func (c *completion) complete(args []string) []Completion { } if argumentIsOption(arg) { - _, optname, islong := stripOptionPrefix(arg) - optname, _, argument := splitOption(optname, islong) + prefix, optname, islong := stripOptionPrefix(arg) + optname, _, argument := splitOption(prefix, optname, islong) if argument == nil { var o *Option @@ -250,7 +250,7 @@ func (c *completion) complete(args []string) []Completion { } else if argumentStartsOption(lastarg) { // Complete the option prefix, optname, islong := stripOptionPrefix(lastarg) - optname, split, argument := splitOption(optname, islong) + optname, split, argument := splitOption(prefix, optname, islong) if argument == nil && !islong { rname, n := utf8.DecodeRuneInString(optname) diff --git a/optstyle_other.go b/optstyle_other.go index 2053db9..f84b697 100644 --- a/optstyle_other.go +++ b/optstyle_other.go @@ -43,7 +43,7 @@ func stripOptionPrefix(optname string) (prefix string, name string, islong bool) // splitOption attempts to split the passed option into a name and an argument. // When there is no argument specified, nil will be returned for it. -func splitOption(option string, islong bool) (string, string, *string) { +func splitOption(prefix string, option string, islong bool) (string, string, *string) { pos := strings.Index(option, "=") if (islong && pos >= 0) || (!islong && pos == 1) { diff --git a/parser.go b/parser.go index f3fb650..939dd7b 100644 --- a/parser.go +++ b/parser.go @@ -279,8 +279,8 @@ func (p *Parser) ParseArgs(args []string) ([]string, error) { continue } - _, optname, islong := stripOptionPrefix(arg) - optname, _, argument := splitOption(optname, islong) + prefix, optname, islong := stripOptionPrefix(arg) + optname, _, argument := splitOption(prefix, optname, islong) if islong { err = p.parseLong(s, optname, argument)