Display "See 'docker cmd --help'." in error cases

This brings back this message in case missing arguments.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
Vincent Demeester 2016-06-04 16:19:54 +02:00
parent bbefa88a8c
commit 4a7a5f3a57
1 changed files with 6 additions and 3 deletions

View File

@ -18,7 +18,8 @@ func NoArgs(cmd *cobra.Command, args []string) error {
} }
return fmt.Errorf( return fmt.Errorf(
"\"%s\" accepts no argument(s).\n\nUsage: %s\n\n%s", "\"%s\" accepts no argument(s).\nSee '%s --help'.\n\nUsage: %s\n\n%s",
cmd.CommandPath(),
cmd.CommandPath(), cmd.CommandPath(),
cmd.UseLine(), cmd.UseLine(),
cmd.Short, cmd.Short,
@ -32,9 +33,10 @@ func RequiresMinArgs(min int) cobra.PositionalArgs {
return nil return nil
} }
return fmt.Errorf( return fmt.Errorf(
"\"%s\" requires at least %d argument(s).\n\nUsage: %s\n\n%s", "\"%s\" requires at least %d argument(s).\nSee '%s --help'.\n\nUsage: %s\n\n%s",
cmd.CommandPath(), cmd.CommandPath(),
min, min,
cmd.CommandPath(),
cmd.UseLine(), cmd.UseLine(),
cmd.Short, cmd.Short,
) )
@ -48,9 +50,10 @@ func ExactArgs(number int) cobra.PositionalArgs {
return nil return nil
} }
return fmt.Errorf( return fmt.Errorf(
"\"%s\" requires exactly %d argument(s).\n\nUsage: %s\n\n%s", "\"%s\" requires exactly %d argument(s).\nSee '%s --help'.\n\nUsage: %s\n\n%s",
cmd.CommandPath(), cmd.CommandPath(),
number, number,
cmd.CommandPath(),
cmd.UseLine(), cmd.UseLine(),
cmd.Short, cmd.Short,
) )