Merge remote-tracking branch 'origin/master' into v2

This commit is contained in:
Dan Buch
2016-05-09 11:18:21 -04:00
13 changed files with 151 additions and 109 deletions

View File

@@ -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
@@ -284,12 +284,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,
@@ -494,7 +494,7 @@ func TestApp_BeforeFunc(t *testing.T) {
}
app.Commands = []Command{
Command{
{
Name: "sub",
Action: func(c *Context) error {
counts.Total++
@@ -586,7 +586,7 @@ func TestApp_AfterFunc(t *testing.T) {
}
app.Commands = []Command{
Command{
{
Name: "sub",
Action: func(c *Context) error {
counts.Total++
@@ -701,7 +701,7 @@ func TestApp_CommandNotFound(t *testing.T) {
}
app.Commands = []Command{
Command{
{
Name: "bar",
Action: func(c *Context) error {
counts.Total++
@@ -768,7 +768,7 @@ func TestApp_OrderOfOperations(t *testing.T) {
app.After = afterNoError
app.Commands = []Command{
Command{
{
Name: "bar",
Action: func(c *Context) error {
counts.Total++
@@ -1103,15 +1103,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",
},
@@ -1152,18 +1152,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",
@@ -1171,13 +1171,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],
@@ -1191,19 +1191,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",
@@ -1211,7 +1211,7 @@ func TestApp_VisibleCategories(t *testing.T) {
}
expected = []*CommandCategory{
&CommandCategory{
{
Name: "3",
Commands: []Command{
app.Commands[2],
@@ -1225,19 +1225,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",
@@ -1273,9 +1273,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",
},
},
@@ -1313,7 +1313,7 @@ func TestApp_OnUsageError_WithWrongFlagValue(t *testing.T) {
return errors.New("intercepted: " + err.Error())
}
app.Commands = []Command{
Command{
{
Name: "bar",
},
}
@@ -1343,7 +1343,7 @@ func TestApp_OnUsageError_WithWrongFlagValue_ForSubcommand(t *testing.T) {
return errors.New("intercepted: " + err.Error())
}
app.Commands = []Command{
Command{
{
Name: "bar",
},
}