Skip to content

Commit

Permalink
Minor cleanup unused parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
jkieboom committed Jun 15, 2024
1 parent 30073cd commit 4eda719
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ func (c *completion) complete(args []string) []Completion {
}

if argumentIsOption(arg) {
prefix, optname, islong := stripOptionPrefix(arg)
optname, _, argument := splitOption(prefix, optname, islong)
_, optname, islong := stripOptionPrefix(arg)
optname, _, argument := splitOption(optname, islong)

if argument == nil {
var o *Option
Expand Down Expand Up @@ -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(prefix, optname, islong)
optname, split, argument := splitOption(optname, islong)

if argument == nil && !islong {
rname, n := utf8.DecodeRuneInString(optname)
Expand Down
2 changes: 1 addition & 1 deletion optstyle_other.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(prefix string, option string, islong bool) (string, string, *string) {
func splitOption(option string, islong bool) (string, string, *string) {
pos := strings.Index(option, "=")

if (islong && pos >= 0) || (!islong && pos == 1) {
Expand Down
4 changes: 2 additions & 2 deletions parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ func (p *Parser) ParseArgs(args []string) ([]string, error) {
continue
}

prefix, optname, islong := stripOptionPrefix(arg)
optname, _, argument := splitOption(prefix, optname, islong)
_, optname, islong := stripOptionPrefix(arg)
optname, _, argument := splitOption(optname, islong)

if islong {
err = p.parseLong(s, optname, argument)
Expand Down

0 comments on commit 4eda719

Please sign in to comment.