{"modulePath":"github.com/xpippi/docker-cli","version":"v23.0.3+incompatible","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package command\n\n## Constants\n\n```go\nconst (\n\t// DefaultContextName is the name reserved for the default context (config \u0026 env based)\n\tDefaultContextName = \"default\"\n)\n```\n\n## Variables\n\n```go\nvar (\n\t// NewInStream returns a new InStream object from a ReadCloser\n\t// Deprecated: Use github.com/docker/cli/cli/streams.NewIn instead\n\tNewInStream = streams.NewIn\n\t// NewOutStream returns a new OutStream object from a Writer\n\t// Deprecated: Use github.com/docker/cli/cli/streams.NewOut instead\n\tNewOutStream = streams.NewOut\n)\n```\n\n## Functions\n\n```go\nfunc AddPlatformFlag(flags *pflag.FlagSet, target *string)\n```\nAddPlatformFlag adds \\`platform\\` to a set of flags for API version 1.32 and later.\n\n```go\nfunc AddTrustSigningFlags(fs *pflag.FlagSet, v *bool, trusted bool)\n```\nAddTrustSigningFlags adds \"signing\" flags to the provided flagset\n\n```go\nfunc AddTrustVerificationFlags(fs *pflag.FlagSet, v *bool, trusted bool)\n```\nAddTrustVerificationFlags adds content trust flags to the provided flagset\n\n```go\nfunc ConfigureAuth(cli Cli, flUser, flPassword string, authconfig *types.AuthConfig, isDefaultRegistry bool) error\n```\nConfigureAuth handles prompting of user's username and password if needed\n\n```go\nfunc CopyToFile(outfile string, r io.Reader) error\n```\nCopyToFile writes the content of the reader to the specified file\n\n```go\nfunc DefaultContextStoreConfig() store.Config\n```\nDefaultContextStoreConfig returns a new store.Config with the default set of endpoints configured.\n\n```go\nfunc ElectAuthServer(_ context.Context, _ Cli) string\n```\nElectAuthServer returns the default registry to use.\n\nDeprecated: use \\[registry.IndexServer] instead.\n\n```go\nfunc EncodeAuthToBase64(authConfig types.AuthConfig) (string, error)\n```\nEncodeAuthToBase64 serializes the auth configuration as JSON base64 payload\n\n```go\nfunc GetDefaultAuthConfig(cli Cli, checkCredStore bool, serverAddress string, isDefaultRegistry bool) (types.AuthConfig, error)\n```\nGetDefaultAuthConfig gets the default auth config given a serverAddress If credentials for given serverAddress exists in the credential store, the configuration will be populated with values in it\n\n```go\nfunc NewAPIClientFromFlags(opts *cliflags.ClientOptions, configFile *configfile.ConfigFile) (client.APIClient, error)\n```\nNewAPIClientFromFlags creates a new APIClient from command line flags\n\n```go\nfunc PrettyPrint(i interface{}) string\n```\nPrettyPrint outputs arbitrary data for human formatted output by uppercasing the first letter.\n\n```go\nfunc PromptForConfirmation(ins io.Reader, outs io.Writer, message string) bool\n```\nPromptForConfirmation requests and checks confirmation from user. This will display the provided message followed by ' [y/N](/y/N) '. If the user input 'y' or 'Y' it returns true other false.  If no message is provided \"Are you sure you want to proceed? [y/N](/y/N) \" will be used instead.\n\n```go\nfunc PruneFilters(dockerCli Cli, pruneFilters filters.Args) filters.Args\n```\nPruneFilters returns consolidated prune filters obtained from config.json and cli\n\n```go\nfunc RegisterDefaultStoreEndpoints(ep ...store.NamedTypeGetter)\n```\nRegisterDefaultStoreEndpoints registers a new named endpoint metadata type with the default context store config, so that endpoint will be supported by stores using the config returned by DefaultContextStoreConfig.\n\n```go\nfunc RegistryAuthenticationPrivilegedFunc(cli Cli, index *registrytypes.IndexInfo, cmdName string) types.RequestPrivilegeFunc\n```\nRegistryAuthenticationPrivilegedFunc returns a RequestPrivilegeFunc from the specified registry index info for the given command.\n\n```go\nfunc ResolveAuthConfig(_ context.Context, cli Cli, index *registrytypes.IndexInfo) types.AuthConfig\n```\nResolveAuthConfig is like registry.ResolveAuthConfig, but if using the default index, it uses the default index name for the daemon's platform, not the client's platform.\n\n```go\nfunc RetrieveAuthTokenFromImage(ctx context.Context, cli Cli, image string) (string, error)\n```\nRetrieveAuthTokenFromImage retrieves an encoded auth token given a complete image\n\n```go\nfunc ShowHelp(err io.Writer) func(*cobra.Command, []string) error\n```\nShowHelp shows the command help.\n\n```go\nfunc StringSliceReplaceAt(s, old, new []string, requireIndex int) ([]string, bool)\n```\nStringSliceReplaceAt replaces the sub-slice old, with the sub-slice new, in the string slice s, returning a new slice and a boolean indicating if the replacement happened. requireIdx is the index at which old needs to be found at (or -1 to disregard that).\n\n```go\nfunc UserAgent() string\n```\nUserAgent returns the user agent string used for making API requests\n\n```go\nfunc ValidateOutputPath(path string) error\n```\nValidateOutputPath validates the output paths of the \\`export\\` and \\`save\\` commands.\n\n```go\nfunc ValidateOutputPathFileMode(fileMode os.FileMode) error\n```\nValidateOutputPathFileMode validates the output paths of the \\`cp\\` command and serves as a helper to \\`ValidateOutputPath\\`\n\n## Types\n\n```go\ntype Cli interface {\n\tClient() client.APIClient\n\tOut() *streams.Out\n\tErr() io.Writer\n\tIn() *streams.In\n\tSetIn(in *streams.In)\n\tApply(ops ...DockerCliOption) error\n\tConfigFile() *configfile.ConfigFile\n\tServerInfo() ServerInfo\n\tNotaryClient(imgRefAndAuth trust.ImageRefAndAuth, actions []string) (notaryclient.Repository, error)\n\tDefaultVersion() string\n\tCurrentVersion() string\n\tManifestStore() manifeststore.Store\n\tRegistryClient(bool) registryclient.RegistryClient\n\tContentTrustEnabled() bool\n\tBuildKitEnabled() (bool, error)\n\tContextStore() store.Store\n\tCurrentContext() string\n\tDockerEndpoint() docker.Endpoint\n}\n```\nCli represents the docker command line client.\n\n```go\ntype ContextStoreWithDefault struct {\n\tstore.Store\n\tResolver DefaultContextResolver\n}\n```\nContextStoreWithDefault implements the store.Store interface with a support for the default context\n\n```go\nfunc (s *ContextStoreWithDefault) CreateOrUpdate(meta store.Metadata) error\n```\nCreateOrUpdate is not allowed for the default context and fails\n\n```go\nfunc (s *ContextStoreWithDefault) GetMetadata(name string) (store.Metadata, error)\n```\nGetMetadata implements store.Store's GetMetadata\n\n```go\nfunc (s *ContextStoreWithDefault) GetStorageInfo(contextName string) store.StorageInfo\n```\nGetStorageInfo implements store.Store's GetStorageInfo\n\n```go\nfunc (s *ContextStoreWithDefault) GetTLSData(contextName, endpointName, fileName string) ([]byte, error)\n```\nGetTLSData implements store.Store's GetTLSData\n\n```go\nfunc (s *ContextStoreWithDefault) List() ([]store.Metadata, error)\n```\nList implements store.Store's List\n\n```go\nfunc (s *ContextStoreWithDefault) ListTLSFiles(name string) (map[string]store.EndpointFiles, error)\n```\nListTLSFiles implements store.Store's ListTLSFiles\n\n```go\nfunc (s *ContextStoreWithDefault) Remove(name string) error\n```\nRemove is not allowed for the default context and fails\n\n```go\nfunc (s *ContextStoreWithDefault) ResetEndpointTLSMaterial(contextName string, endpointName string, data *store.EndpointTLSData) error\n```\nResetEndpointTLSMaterial is not implemented for default context and fails\n\n```go\nfunc (s *ContextStoreWithDefault) ResetTLSMaterial(name string, data *store.ContextTLSData) error\n```\nResetTLSMaterial is not implemented for default context and fails\n\n```go\ntype DefaultContext struct {\n\tMeta store.Metadata\n\tTLS  store.ContextTLSData\n}\n```\nDefaultContext contains the default context data for all endpoints\n\n```go\nfunc ResolveDefaultContext(opts *cliflags.ClientOptions, config store.Config) (*DefaultContext, error)\n```\nResolveDefaultContext creates a Metadata for the current CLI invocation parameters\n\n```go\ntype DefaultContextResolver func() (*DefaultContext, error)\n```\nDefaultContextResolver is a function which resolves the default context base on the configuration and the env variables\n\n```go\ntype DockerCli struct {\n\t// contains filtered or unexported fields\n}\n```\nDockerCli is an instance the docker command line client. Instances of the client can be returned from NewDockerCli.\n\n```go\nfunc NewDockerCli(ops ...DockerCliOption) (*DockerCli, error)\n```\nNewDockerCli returns a DockerCli instance with all operators applied on it. It applies by default the standard streams, and the content trust from environment.\n\n```go\nfunc (cli *DockerCli) Apply(ops ...DockerCliOption) error\n```\nApply all the operation on the cli\n\n```go\nfunc (cli *DockerCli) BuildKitEnabled() (bool, error)\n```\nBuildKitEnabled returns buildkit is enabled or not.\n\n```go\nfunc (cli *DockerCli) Client() client.APIClient\n```\nClient returns the APIClient\n\n```go\nfunc (cli *DockerCli) ConfigFile() *configfile.ConfigFile\n```\nConfigFile returns the ConfigFile\n\n```go\nfunc (cli *DockerCli) ContentTrustEnabled() bool\n```\nContentTrustEnabled returns whether content trust has been enabled by an environment variable.\n\n```go\nfunc (cli *DockerCli) ContextStore() store.Store\n```\nContextStore returns the ContextStore\n\n```go\nfunc (cli *DockerCli) CurrentContext() string\n```\nCurrentContext returns the current context name, based on flags, environment variables and the cli configuration file, in the following order of preference:\n\n 1. The \"--context\" command-line option.\n 2. The \"DOCKER\\_CONTEXT\" environment variable.\n 3. The current context as configured through the in \"currentContext\" field in the CLI configuration file (\"~/.docker/config.json\").\n 4. If no context is configured, use the \"default\" context.\n\n### Fallbacks for backward-compatibility {#hdr-Fallbacks_for_backward_compatibility}\n\nTo preserve backward-compatibility with the \"pre-contexts\" behavior, the \"default\" context is used if:\n\n  - The \"--host\" option is set\n  - The \"DOCKER\\_HOST\" ([DefaultContextName](#DefaultContextName)) environment variable is set to a non-empty value.\n\nIn these cases, the default context is used, which uses the host as specified in \"DOCKER\\_HOST\", and TLS config from flags/env vars.\n\nSetting both the \"--context\" and \"--host\" flags is ambiguous and results in an error when the cli is started.\n\nCurrentContext does not validate if the given context exists or if it's valid; errors may occur when trying to use it.\n\n```go\nfunc (cli *DockerCli) CurrentVersion() string\n```\nCurrentVersion returns the API version currently negotiated, or the default version otherwise.\n\n```go\nfunc (cli *DockerCli) DefaultVersion() string\n```\nDefaultVersion returns api.defaultVersion.\n\n```go\nfunc (cli *DockerCli) DockerEndpoint() docker.Endpoint\n```\nDockerEndpoint returns the current docker endpoint\n\n```go\nfunc (cli *DockerCli) Err() io.Writer\n```\nErr returns the writer used for stderr\n\n```go\nfunc (cli *DockerCli) In() *streams.In\n```\nIn returns the reader used for stdin\n\n```go\nfunc (cli *DockerCli) Initialize(opts *cliflags.ClientOptions, ops ...InitializeOpt) error\n```\nInitialize the dockerCli runs initialization that must happen after command line flags are parsed.\n\n```go\nfunc (cli *DockerCli) ManifestStore() manifeststore.Store\n```\nManifestStore returns a store for local manifests\n\n```go\nfunc (cli *DockerCli) NotaryClient(imgRefAndAuth trust.ImageRefAndAuth, actions []string) (notaryclient.Repository, error)\n```\nNotaryClient provides a Notary Repository to interact with signed metadata for an image\n\n```go\nfunc (cli *DockerCli) Out() *streams.Out\n```\nOut returns the writer used for stdout\n\n```go\nfunc (cli *DockerCli) RegistryClient(allowInsecure bool) registryclient.RegistryClient\n```\nRegistryClient returns a client for communicating with a Docker distribution registry\n\n```go\nfunc (cli *DockerCli) ServerInfo() ServerInfo\n```\nServerInfo returns the server version details for the host this client is connected to\n\n```go\nfunc (cli *DockerCli) SetIn(in *streams.In)\n```\nSetIn sets the reader used for stdin\n\n```go\ntype DockerCliOption func(cli *DockerCli) error\n```\nDockerCliOption applies a modification on a DockerCli.\n\n```go\nfunc WithAPIClient(c client.APIClient) DockerCliOption\n```\nWithAPIClient configures the cli to use the given API client.\n\n```go\nfunc WithCombinedStreams(combined io.Writer) DockerCliOption\n```\nWithCombinedStreams uses the same stream for the output and error streams.\n\n```go\nfunc WithContentTrust(enabled bool) DockerCliOption\n```\nWithContentTrust enables content trust on a cli.\n\n```go\nfunc WithContentTrustFromEnv() DockerCliOption\n```\nWithContentTrustFromEnv enables content trust on a cli from environment variable DOCKER\\_CONTENT\\_TRUST value.\n\n```go\nfunc WithDefaultContextStoreConfig() DockerCliOption\n```\nWithDefaultContextStoreConfig configures the cli to use the default context store configuration.\n\n```go\nfunc WithErrorStream(err io.Writer) DockerCliOption\n```\nWithErrorStream sets a cli error stream.\n\n```go\nfunc WithInputStream(in io.ReadCloser) DockerCliOption\n```\nWithInputStream sets a cli input stream.\n\n```go\nfunc WithOutputStream(out io.Writer) DockerCliOption\n```\nWithOutputStream sets a cli output stream.\n\n```go\nfunc WithStandardStreams() DockerCliOption\n```\nWithStandardStreams sets a cli in, out and err streams with the standard streams.\n\n```go\ntype DockerContext struct {\n\tDescription      string\n\tAdditionalFields map[string]interface{}\n}\n```\nDockerContext is a typed representation of what we put in Context metadata\n\n```go\nfunc GetDockerContext(storeMetadata store.Metadata) (DockerContext, error)\n```\nGetDockerContext extracts metadata from stored context metadata\n\n```go\nfunc (dc DockerContext) MarshalJSON() ([]byte, error)\n```\nMarshalJSON implements custom JSON marshalling\n\n```go\nfunc (dc *DockerContext) UnmarshalJSON(payload []byte) error\n```\nUnmarshalJSON implements custom JSON marshalling\n\n```go\ntype EndpointDefaultResolver interface {\n\t// ResolveDefault returns values suitable for storing in store.Metadata.Endpoints\n\t// and store.ContextTLSData.Endpoints.\n\t//\n\t// An error is only returned for something fatal, not simply\n\t// the lack of a default (e.g. because the config file which\n\t// would contain it is missing). If there is no default then\n\t// returns nil, nil, nil.\n\tResolveDefault() (interface{}, *store.EndpointTLSData, error)\n}\n```\nEndpointDefaultResolver is implemented by any EndpointMeta object which wants to be able to populate the store with whatever their default is.\n\n```go\ntype EventHandler interface {\n\tHandle(action string, h func(eventtypes.Message))\n\tWatch(c \u003c-chan eventtypes.Message)\n}\n```\nEventHandler is abstract interface for user to customize own handle functions of each type of events\n\n```go\nfunc InitEventHandler() EventHandler\n```\nInitEventHandler initializes and returns an EventHandler\n\n```go\ntype InStream = streams.In\n```\nInStream is an input stream used by the DockerCli to read user input Deprecated: Use github.com/docker/cli/cli/streams.In instead\n\n```go\ntype InitializeOpt func(dockerCli *DockerCli) error\n```\nInitializeOpt is the type of the functional options passed to DockerCli.Initialize\n\n```go\nfunc WithInitializeClient(makeClient func(dockerCli *DockerCli) (client.APIClient, error)) InitializeOpt\n```\nWithInitializeClient is passed to DockerCli.Initialize by callers who wish to set a particular API Client for use by the CLI.\n\n```go\ntype OutStream = streams.Out\n```\nOutStream is an output stream used by the DockerCli to write normal program output. Deprecated: Use github.com/docker/cli/cli/streams.Out instead\n\n```go\ntype ServerInfo struct {\n\tHasExperimental bool\n\tOSType          string\n\tBuildkitVersion types.BuilderVersion\n\n\t// SwarmStatus provides information about the current swarm status of the\n\t// engine, obtained from the \"Swarm\" header in the API response.\n\t//\n\t// It can be a nil struct if the API version does not provide this header\n\t// in the ping response, or if an error occurred, in which case the client\n\t// should use other ways to get the current swarm status, such as the /swarm\n\t// endpoint.\n\tSwarmStatus *swarm.Status\n}\n```\nServerInfo stores details about the supported features and platform of the server\n\n```go\ntype Streams interface {\n\tIn() *streams.In\n\tOut() *streams.Out\n\tErr() io.Writer\n}\n```\nStreams is an interface which exposes the standard input and output streams\n\n","path":"github.com/xpippi/docker-cli/cli/command","name":"command","synopsis":"","isRedistributable":true}
