Skip to content

Commit

Permalink
Remove redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
dearchap committed Jun 5, 2023
1 parent 0b3304b commit d93839a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions help.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,16 +211,12 @@ func DefaultCompleteWithFlags(cmd *Command) func(cCtx *Context) {
return func(cCtx *Context) {
var lastArg string

// TODO: This shouldnt depend on os.Args rather it should
// depend on root arguments passed to App
if len(os.Args) > 2 {
lastArg = os.Args[len(os.Args)-2]
}

if cmd != nil {
if cCtx.NArg() > 1 {
lastArg = cCtx.Args().Get(cCtx.NArg() - 1)
}
}

if lastArg != "" {
if strings.HasPrefix(lastArg, "-") {
if cmd != nil {
Expand Down

0 comments on commit d93839a

Please sign in to comment.