diff --git a/command.go b/command.go index 4b46955..864abca 100644 --- a/command.go +++ b/command.go @@ -536,6 +536,8 @@ func defaultHelp(cmd *Command) error { writePositionalArgs(cmd, s) } else { // We have no named arguments so do the best we can + // TODO(@FollowTheProcess): Can we detect if cli.NoArgs was used in which case + // omit this s.WriteString("ARGS...") } } else { diff --git a/docs/img/namedargs.gif b/docs/img/namedargs.gif index c95cec0..3215e94 100644 Binary files a/docs/img/namedargs.gif and b/docs/img/namedargs.gif differ diff --git a/docs/img/quickstart.gif b/docs/img/quickstart.gif index e73f3e6..4d9f068 100644 Binary files a/docs/img/quickstart.gif and b/docs/img/quickstart.gif differ diff --git a/docs/img/subcommands.gif b/docs/img/subcommands.gif index d1547e7..7ae6ebc 100644 Binary files a/docs/img/subcommands.gif and b/docs/img/subcommands.gif differ diff --git a/examples/subcommands/cli.go b/examples/subcommands/cli.go index 44452cd..9d80713 100644 --- a/examples/subcommands/cli.go +++ b/examples/subcommands/cli.go @@ -9,7 +9,7 @@ import ( ) func BuildCLI() (*cli.Command, error) { - demo, err := cli.New( + return cli.New( "demo", cli.Short("An example CLI to demonstrate the library and play with it for real."), cli.Version("dev"), @@ -20,11 +20,6 @@ func BuildCLI() (*cli.Command, error) { cli.Allow(cli.NoArgs()), cli.SubCommands(buildSayCommand, buildDoCommand), ) - if err != nil { - return nil, err - } - - return demo, nil } type sayOptions struct { @@ -35,7 +30,7 @@ type sayOptions struct { func buildSayCommand() (*cli.Command, error) { var options sayOptions - say, err := cli.New( + return cli.New( "say", cli.Short("Print a message"), cli.Example("Say a well known phrase", "demo say hello world"), @@ -45,11 +40,6 @@ func buildSayCommand() (*cli.Command, error) { cli.Flag(&options.count, "count", 'c', 0, "Count the things"), cli.Flag(&options.thing, "thing", 't', "", "Name of the thing"), ) - if err != nil { - return nil, err - } - - return say, nil } type doOptions struct { @@ -61,7 +51,7 @@ type doOptions struct { func buildDoCommand() (*cli.Command, error) { var options doOptions - do, err := cli.New( + return cli.New( "do", cli.Short("Do a thing"), cli.Example("Do something", "demo do something --fast"), @@ -74,11 +64,6 @@ func buildDoCommand() (*cli.Command, error) { cli.Flag(&options.duration, "duration", 'd', 1*time.Second, "Do the thing for a specific duration"), cli.Run(runDo(&options)), ) - if err != nil { - return nil, err - } - - return do, nil } func runSay(options *sayOptions) func(cmd *cli.Command, args []string) error {