Add cli updates amd change mb help a bit
This commit is contained in:
+4
@@ -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
@@ -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")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user