Add cli updates amd change mb help a bit

This commit is contained in:
Harshavardhana
2015-09-05 22:46:23 -07:00
parent 0eb1403caf
commit bf22c490a3
4 changed files with 8 additions and 6 deletions
+4
View File
@@ -1,6 +1,7 @@
package cli
import (
"errors"
"fmt"
"io"
"os"
@@ -290,6 +291,9 @@ func (a *App) RunAsSubcommand(ctx *Context) (err error) {
if c != nil {
return c.Run(context)
}
fmt.Fprintf(a.Writer, "Incorrect Usage.\n\n")
ShowSubcommandHelp(context)
return errors.New("Command not found")
}
// Run default Action
+1 -3
View File
@@ -181,9 +181,7 @@ func TestApp_RunAsSubcommandParseFlags(t *testing.T) {
Before: func(_ *cli.Context) error { return nil },
},
}
a.Run([]string{"", "foo", "--lang", "spanish", "abcd"})
expect(t, context.Args().Get(0), "abcd")
a.Run([]string{"", "foo", "--lang", "spanish"})
expect(t, context.String("lang"), "spanish")
}