Skip to content
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

Merged
merged 6 commits into from
Jan 28, 2018
Merged

lint + DefaultCommand #662

merged 6 commits into from
Jan 28, 2018

Conversation

OneOfOne
Copy link
Contributor

This adds a global function that can be passed to app.Action to execute a default command.

Fixes #657

@jszwedko
Copy link
Contributor

I missed this somehow, will review soon.

@jszwedko jszwedko self-assigned this Jan 15, 2018
Copy link
Contributor

@jszwedko jszwedko left a 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")`
Copy link
Contributor

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] != '-' {
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@jszwedko jszwedko left a 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 !

@jszwedko jszwedko merged commit 1355f91 into urfave:v2 Jan 28, 2018
@omerxx
Copy link

omerxx commented Aug 4, 2018

Hey @OneOfOne and @jszwedko, great addition. I think an addition to the documentation would be great. I got here by mistake after searching through issues to find this default option. Found it only after implementing it on my own...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants