mirror of
https://github.com/genuinetools/reg.git
synced 2024-09-12 06:11:03 -04:00
27 lines
569 B
Go
27 lines
569 B
Go
package cli // import "github.com/docker/docker/cli"
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/pkg/errors"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
// NoArgs validates args and returns an error if there are any args
|
|
func NoArgs(cmd *cobra.Command, args []string) error {
|
|
if len(args) == 0 {
|
|
return nil
|
|
}
|
|
|
|
if cmd.HasSubCommands() {
|
|
return errors.Errorf("\n" + strings.TrimRight(cmd.UsageString(), "\n"))
|
|
}
|
|
|
|
return errors.Errorf(
|
|
"\"%s\" accepts no argument(s).\nSee '%s --help'.\n\nUsage: %s\n\n%s",
|
|
cmd.CommandPath(),
|
|
cmd.CommandPath(),
|
|
cmd.UseLine(),
|
|
cmd.Short,
|
|
)
|
|
}
|