-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lint + DefaultCommand #662
Conversation
I missed this somehow, will review soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for submitting this @OneOfOne ! Apologies for the severe delay in review, I completely lost track of this PR.
app.go
Outdated
@@ -480,3 +480,11 @@ func (a *Author) String() string { | |||
|
|||
return fmt.Sprintf("%v%v", a.Name, e) | |||
} | |||
|
|||
// DefaultAppComplete returns an ActionFunc to run a default command if non were passed. | |||
// Usage: `app.Action = DefaultCommand("command")` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the target of this comment is likely to be end-users, could we use cli.DefaultCommand("command")
?
flag.go
Outdated
@@ -778,7 +778,7 @@ func visibleFlags(fl []Flag) []Flag { | |||
func prefixFor(name string) (prefix string) { | |||
if len(name) == 1 { | |||
prefix = "-" | |||
} else { | |||
} else if name[0] != '-' { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to include this change? It seems unrelated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, yeah, I don't even remember why I did that, but I needed it for something, removed it tho.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks for the changes @OneOfOne !
This adds a global function that can be passed to app.Action to execute a default command.
Fixes #657