Fixed spelling and gofmt issues
This commit is contained in:
parent
63ed8b0bde
commit
2f4ec31264
2
app.go
2
app.go
@ -51,7 +51,7 @@ type App struct {
|
||||
HideHelp bool
|
||||
// Boolean to hide built-in version flag and the VERSION section of help
|
||||
HideVersion bool
|
||||
// Populate on app startup, only gettable throught method Categories()
|
||||
// Populate on app startup, only gettable through method Categories()
|
||||
categories CommandCategories
|
||||
// An action to execute when the bash-completion flag is set
|
||||
BashComplete BashCompleteFunc
|
||||
|
52
app_test.go
52
app_test.go
@ -33,7 +33,7 @@ func ExampleApp_Run() {
|
||||
app.UsageText = "app [first_arg] [second_arg]"
|
||||
app.Author = "Harrison"
|
||||
app.Email = "harrison@lolwut.com"
|
||||
app.Authors = []Author{Author{Name: "Oliver Allen", Email: "oliver@toyshop.com"}}
|
||||
app.Authors = []Author{{Name: "Oliver Allen", Email: "oliver@toyshop.com"}}
|
||||
app.Run(os.Args)
|
||||
// Output:
|
||||
// Hello Jeremy
|
||||
@ -307,12 +307,12 @@ func TestApp_CommandWithNoFlagBeforeTerminator(t *testing.T) {
|
||||
func TestApp_VisibleCommands(t *testing.T) {
|
||||
app := NewApp()
|
||||
app.Commands = []Command{
|
||||
Command{
|
||||
{
|
||||
Name: "frob",
|
||||
HelpName: "foo frob",
|
||||
Action: func(_ *Context) error { return nil },
|
||||
},
|
||||
Command{
|
||||
{
|
||||
Name: "frib",
|
||||
HelpName: "foo frib",
|
||||
Hidden: true,
|
||||
@ -517,7 +517,7 @@ func TestApp_BeforeFunc(t *testing.T) {
|
||||
}
|
||||
|
||||
app.Commands = []Command{
|
||||
Command{
|
||||
{
|
||||
Name: "sub",
|
||||
Action: func(c *Context) error {
|
||||
counts.Total++
|
||||
@ -609,7 +609,7 @@ func TestApp_AfterFunc(t *testing.T) {
|
||||
}
|
||||
|
||||
app.Commands = []Command{
|
||||
Command{
|
||||
{
|
||||
Name: "sub",
|
||||
Action: func(c *Context) error {
|
||||
counts.Total++
|
||||
@ -724,7 +724,7 @@ func TestApp_CommandNotFound(t *testing.T) {
|
||||
}
|
||||
|
||||
app.Commands = []Command{
|
||||
Command{
|
||||
{
|
||||
Name: "bar",
|
||||
Action: func(c *Context) error {
|
||||
counts.Total++
|
||||
@ -791,7 +791,7 @@ func TestApp_OrderOfOperations(t *testing.T) {
|
||||
|
||||
app.After = afterNoError
|
||||
app.Commands = []Command{
|
||||
Command{
|
||||
{
|
||||
Name: "bar",
|
||||
Action: func(c *Context) error {
|
||||
counts.Total++
|
||||
@ -1126,15 +1126,15 @@ func TestApp_Run_Categories(t *testing.T) {
|
||||
app := NewApp()
|
||||
app.Name = "categories"
|
||||
app.Commands = []Command{
|
||||
Command{
|
||||
{
|
||||
Name: "command1",
|
||||
Category: "1",
|
||||
},
|
||||
Command{
|
||||
{
|
||||
Name: "command2",
|
||||
Category: "1",
|
||||
},
|
||||
Command{
|
||||
{
|
||||
Name: "command3",
|
||||
Category: "2",
|
||||
},
|
||||
@ -1175,18 +1175,18 @@ func TestApp_VisibleCategories(t *testing.T) {
|
||||
app := NewApp()
|
||||
app.Name = "visible-categories"
|
||||
app.Commands = []Command{
|
||||
Command{
|
||||
{
|
||||
Name: "command1",
|
||||
Category: "1",
|
||||
HelpName: "foo command1",
|
||||
Hidden: true,
|
||||
},
|
||||
Command{
|
||||
{
|
||||
Name: "command2",
|
||||
Category: "2",
|
||||
HelpName: "foo command2",
|
||||
},
|
||||
Command{
|
||||
{
|
||||
Name: "command3",
|
||||
Category: "3",
|
||||
HelpName: "foo command3",
|
||||
@ -1194,13 +1194,13 @@ func TestApp_VisibleCategories(t *testing.T) {
|
||||
}
|
||||
|
||||
expected := []*CommandCategory{
|
||||
&CommandCategory{
|
||||
{
|
||||
Name: "2",
|
||||
Commands: []Command{
|
||||
app.Commands[1],
|
||||
},
|
||||
},
|
||||
&CommandCategory{
|
||||
{
|
||||
Name: "3",
|
||||
Commands: []Command{
|
||||
app.Commands[2],
|
||||
@ -1214,19 +1214,19 @@ func TestApp_VisibleCategories(t *testing.T) {
|
||||
app = NewApp()
|
||||
app.Name = "visible-categories"
|
||||
app.Commands = []Command{
|
||||
Command{
|
||||
{
|
||||
Name: "command1",
|
||||
Category: "1",
|
||||
HelpName: "foo command1",
|
||||
Hidden: true,
|
||||
},
|
||||
Command{
|
||||
{
|
||||
Name: "command2",
|
||||
Category: "2",
|
||||
HelpName: "foo command2",
|
||||
Hidden: true,
|
||||
},
|
||||
Command{
|
||||
{
|
||||
Name: "command3",
|
||||
Category: "3",
|
||||
HelpName: "foo command3",
|
||||
@ -1234,7 +1234,7 @@ func TestApp_VisibleCategories(t *testing.T) {
|
||||
}
|
||||
|
||||
expected = []*CommandCategory{
|
||||
&CommandCategory{
|
||||
{
|
||||
Name: "3",
|
||||
Commands: []Command{
|
||||
app.Commands[2],
|
||||
@ -1248,19 +1248,19 @@ func TestApp_VisibleCategories(t *testing.T) {
|
||||
app = NewApp()
|
||||
app.Name = "visible-categories"
|
||||
app.Commands = []Command{
|
||||
Command{
|
||||
{
|
||||
Name: "command1",
|
||||
Category: "1",
|
||||
HelpName: "foo command1",
|
||||
Hidden: true,
|
||||
},
|
||||
Command{
|
||||
{
|
||||
Name: "command2",
|
||||
Category: "2",
|
||||
HelpName: "foo command2",
|
||||
Hidden: true,
|
||||
},
|
||||
Command{
|
||||
{
|
||||
Name: "command3",
|
||||
Category: "3",
|
||||
HelpName: "foo command3",
|
||||
@ -1296,9 +1296,9 @@ func TestApp_Run_DoesNotOverwriteErrorFromBefore(t *testing.T) {
|
||||
func TestApp_Run_SubcommandDoesNotOverwriteErrorFromBefore(t *testing.T) {
|
||||
app := NewApp()
|
||||
app.Commands = []Command{
|
||||
Command{
|
||||
{
|
||||
Subcommands: []Command{
|
||||
Command{
|
||||
{
|
||||
Name: "sub",
|
||||
},
|
||||
},
|
||||
@ -1336,7 +1336,7 @@ func TestApp_OnUsageError_WithWrongFlagValue(t *testing.T) {
|
||||
return errors.New("intercepted: " + err.Error())
|
||||
}
|
||||
app.Commands = []Command{
|
||||
Command{
|
||||
{
|
||||
Name: "bar",
|
||||
},
|
||||
}
|
||||
@ -1366,7 +1366,7 @@ func TestApp_OnUsageError_WithWrongFlagValue_ForSubcommand(t *testing.T) {
|
||||
return errors.New("intercepted: " + err.Error())
|
||||
}
|
||||
app.Commands = []Command{
|
||||
Command{
|
||||
{
|
||||
Name: "bar",
|
||||
},
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ func TestCommandFlagParsing(t *testing.T) {
|
||||
func TestCommand_Run_DoesNotOverwriteErrorFromBefore(t *testing.T) {
|
||||
app := NewApp()
|
||||
app.Commands = []Command{
|
||||
Command{
|
||||
{
|
||||
Name: "bar",
|
||||
Before: func(c *Context) error {
|
||||
return fmt.Errorf("before error")
|
||||
@ -76,7 +76,7 @@ func TestCommand_Run_DoesNotOverwriteErrorFromBefore(t *testing.T) {
|
||||
func TestCommand_OnUsageError_WithWrongFlagValue(t *testing.T) {
|
||||
app := NewApp()
|
||||
app.Commands = []Command{
|
||||
Command{
|
||||
{
|
||||
Name: "bar",
|
||||
Flags: []Flag{
|
||||
IntFlag{Name: "flag"},
|
||||
|
@ -199,7 +199,7 @@ func TestContext_GlobalFlagsInSubcommands(t *testing.T) {
|
||||
}
|
||||
|
||||
app.Commands = []Command{
|
||||
Command{
|
||||
{
|
||||
Name: "foo",
|
||||
Flags: []Flag{
|
||||
BoolFlag{Name: "parent, p", Usage: "Parent flag"},
|
||||
|
@ -172,13 +172,13 @@ func Test_helpSubcommand_Action_ErrorIfNoTopic(t *testing.T) {
|
||||
func TestShowAppHelp_HiddenCommand(t *testing.T) {
|
||||
app := &App{
|
||||
Commands: []Command{
|
||||
Command{
|
||||
{
|
||||
Name: "frobbly",
|
||||
Action: func(ctx *Context) error {
|
||||
return nil
|
||||
},
|
||||
},
|
||||
Command{
|
||||
{
|
||||
Name: "secretfrob",
|
||||
Hidden: true,
|
||||
Action: func(ctx *Context) error {
|
||||
|
Loading…
Reference in New Issue
Block a user