{"modulePath":"github.com/docker/CLI","version":"v29.10.1+incompatible","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package cli\n\n## Functions\n\n```go\nfunc ExactArgs(number int) cobra.PositionalArgs\n```\nExactArgs returns an error if there is not the exact number of args\n\n```go\nfunc FlagErrorFunc(cmd *cobra.Command, err error) error\n```\nFlagErrorFunc prints an error message which matches the format of the docker/cli/cli error messages\n\n```go\nfunc NoArgs(cmd *cobra.Command, args []string) error\n```\nNoArgs validates args and returns an error if there are any args\n\n```go\nfunc RequiresMaxArgs(maxArgs int) cobra.PositionalArgs\n```\nRequiresMaxArgs returns an error if there is not at most max args\n\n```go\nfunc RequiresMinArgs(minArgs int) cobra.PositionalArgs\n```\nRequiresMinArgs returns an error if there is not at least min args\n\n```go\nfunc RequiresRangeArgs(minArgs int, maxArgs int) cobra.PositionalArgs\n```\nRequiresRangeArgs returns an error if there is not at least min args and at most max args\n\n```go\nfunc SetupPluginRootCommand(rootCmd *cobra.Command) (*cliflags.ClientOptions, *pflag.FlagSet)\n```\nSetupPluginRootCommand sets default usage, help and error handling for a plugin root command.\n\n```go\nfunc SetupRootCommand(rootCmd *cobra.Command) (opts *cliflags.ClientOptions, helpCmd *cobra.Command)\n```\nSetupRootCommand sets default usage, help, and error handling for the root command.\n\n## Types\n\n```go\ntype StatusError struct {\n\tCause      error\n\tStatus     string\n\tStatusCode int\n}\n```\nStatusError reports an unsuccessful exit by a command.\n\n```go\nfunc (e StatusError) Error() string\n```\nError formats the error for printing. If a custom Status is provided, it is returned as-is, otherwise it generates a generic error-message based on the StatusCode.\n\n```go\nfunc (e StatusError) Unwrap() error\n```\n\n```go\ntype TopLevelCommand struct {\n\t// contains filtered or unexported fields\n}\n```\nTopLevelCommand encapsulates a top-level cobra command (either docker CLI or a plugin) and global flag handling logic necessary for plugins.\n\n```go\nfunc NewTopLevelCommand(cmd *cobra.Command, dockerCli *command.DockerCli, opts *cliflags.ClientOptions, flags *pflag.FlagSet) *TopLevelCommand\n```\nNewTopLevelCommand returns a new TopLevelCommand object\n\n```go\nfunc (tcmd *TopLevelCommand) HandleGlobalFlags() (*cobra.Command, []string, error)\n```\nHandleGlobalFlags takes care of parsing global flags defined on the command, it returns the underlying cobra command and the args it will be called with (or an error).\n\nOn success the caller is responsible for calling Initialize() before calling \\`Execute\\` on the returned command.\n\n```go\nfunc (tcmd *TopLevelCommand) Initialize(ops ...command.CLIOption) error\n```\nInitialize finalises global option parsing and initializes the docker client.\n\n```go\nfunc (tcmd *TopLevelCommand) SetArgs(args []string)\n```\nSetArgs sets the args (default os.Args\\[:1] used to invoke the command\n\n```go\nfunc (tcmd *TopLevelCommand) SetFlag(name, value string)\n```\nSetFlag sets a flag in the local flag set of the top-level command\n\n","path":"github.com/docker/CLI/cli","name":"cli","synopsis":"","isRedistributable":true}
