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