repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
partition
stringclasses
1 value
docker/cli
cli/command/utils.go
CopyToFile
func CopyToFile(outfile string, r io.Reader) error { // We use sequential file access here to avoid depleting the standby list // on Windows. On Linux, this is a call directly to ioutil.TempFile tmpFile, err := system.TempFileSequential(filepath.Dir(outfile), ".docker_temp_") if err != nil { return err } tmpPa...
go
func CopyToFile(outfile string, r io.Reader) error { // We use sequential file access here to avoid depleting the standby list // on Windows. On Linux, this is a call directly to ioutil.TempFile tmpFile, err := system.TempFileSequential(filepath.Dir(outfile), ".docker_temp_") if err != nil { return err } tmpPa...
[ "func", "CopyToFile", "(", "outfile", "string", ",", "r", "io", ".", "Reader", ")", "error", "{", "// We use sequential file access here to avoid depleting the standby list", "// on Windows. On Linux, this is a call directly to ioutil.TempFile", "tmpFile", ",", "err", ":=", "sy...
// CopyToFile writes the content of the reader to the specified file
[ "CopyToFile", "writes", "the", "content", "of", "the", "reader", "to", "the", "specified", "file" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/utils.go#L20-L44
train
docker/cli
cli/command/utils.go
capitalizeFirst
func capitalizeFirst(s string) string { switch l := len(s); l { case 0: return s case 1: return strings.ToLower(s) default: return strings.ToUpper(string(s[0])) + strings.ToLower(s[1:]) } }
go
func capitalizeFirst(s string) string { switch l := len(s); l { case 0: return s case 1: return strings.ToLower(s) default: return strings.ToUpper(string(s[0])) + strings.ToLower(s[1:]) } }
[ "func", "capitalizeFirst", "(", "s", "string", ")", "string", "{", "switch", "l", ":=", "len", "(", "s", ")", ";", "l", "{", "case", "0", ":", "return", "s", "\n", "case", "1", ":", "return", "strings", ".", "ToLower", "(", "s", ")", "\n", "defau...
// capitalizeFirst capitalizes the first character of string
[ "capitalizeFirst", "capitalizes", "the", "first", "character", "of", "string" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/utils.go#L47-L56
train
docker/cli
cli/command/utils.go
PrettyPrint
func PrettyPrint(i interface{}) string { switch t := i.(type) { case nil: return "None" case string: return capitalizeFirst(t) default: return capitalizeFirst(fmt.Sprintf("%s", t)) } }
go
func PrettyPrint(i interface{}) string { switch t := i.(type) { case nil: return "None" case string: return capitalizeFirst(t) default: return capitalizeFirst(fmt.Sprintf("%s", t)) } }
[ "func", "PrettyPrint", "(", "i", "interface", "{", "}", ")", "string", "{", "switch", "t", ":=", "i", ".", "(", "type", ")", "{", "case", "nil", ":", "return", "\"", "\"", "\n", "case", "string", ":", "return", "capitalizeFirst", "(", "t", ")", "\n...
// PrettyPrint outputs arbitrary data for human formatted output by uppercasing the first letter.
[ "PrettyPrint", "outputs", "arbitrary", "data", "for", "human", "formatted", "output", "by", "uppercasing", "the", "first", "letter", "." ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/utils.go#L59-L68
train
docker/cli
cli/command/utils.go
PruneFilters
func PruneFilters(dockerCli Cli, pruneFilters filters.Args) filters.Args { if dockerCli.ConfigFile() == nil { return pruneFilters } for _, f := range dockerCli.ConfigFile().PruneFilters { parts := strings.SplitN(f, "=", 2) if len(parts) != 2 { continue } if parts[0] == "label" { // CLI label filter s...
go
func PruneFilters(dockerCli Cli, pruneFilters filters.Args) filters.Args { if dockerCli.ConfigFile() == nil { return pruneFilters } for _, f := range dockerCli.ConfigFile().PruneFilters { parts := strings.SplitN(f, "=", 2) if len(parts) != 2 { continue } if parts[0] == "label" { // CLI label filter s...
[ "func", "PruneFilters", "(", "dockerCli", "Cli", ",", "pruneFilters", "filters", ".", "Args", ")", "filters", ".", "Args", "{", "if", "dockerCli", ".", "ConfigFile", "(", ")", "==", "nil", "{", "return", "pruneFilters", "\n", "}", "\n", "for", "_", ",", ...
// PruneFilters returns consolidated prune filters obtained from config.json and cli
[ "PruneFilters", "returns", "consolidated", "prune", "filters", "obtained", "from", "config", ".", "json", "and", "cli" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/utils.go#L94-L122
train
docker/cli
cli/command/utils.go
AddPlatformFlag
func AddPlatformFlag(flags *pflag.FlagSet, target *string) { flags.StringVar(target, "platform", os.Getenv("DOCKER_DEFAULT_PLATFORM"), "Set platform if server is multi-platform capable") flags.SetAnnotation("platform", "version", []string{"1.32"}) flags.SetAnnotation("platform", "experimental", nil) }
go
func AddPlatformFlag(flags *pflag.FlagSet, target *string) { flags.StringVar(target, "platform", os.Getenv("DOCKER_DEFAULT_PLATFORM"), "Set platform if server is multi-platform capable") flags.SetAnnotation("platform", "version", []string{"1.32"}) flags.SetAnnotation("platform", "experimental", nil) }
[ "func", "AddPlatformFlag", "(", "flags", "*", "pflag", ".", "FlagSet", ",", "target", "*", "string", ")", "{", "flags", ".", "StringVar", "(", "target", ",", "\"", "\"", ",", "os", ".", "Getenv", "(", "\"", "\"", ")", ",", "\"", "\"", ")", "\n", ...
// AddPlatformFlag adds `platform` to a set of flags for API version 1.32 and later.
[ "AddPlatformFlag", "adds", "platform", "to", "a", "set", "of", "flags", "for", "API", "version", "1", ".", "32", "and", "later", "." ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/utils.go#L125-L129
train
docker/cli
cli/command/utils.go
ValidateOutputPath
func ValidateOutputPath(path string) error { dir := filepath.Dir(path) if dir != "" && dir != "." { if _, err := os.Stat(dir); os.IsNotExist(err) { return errors.Errorf("invalid output path: directory %q does not exist", dir) } } // check whether `path` points to a regular file // (if the path exists and do...
go
func ValidateOutputPath(path string) error { dir := filepath.Dir(path) if dir != "" && dir != "." { if _, err := os.Stat(dir); os.IsNotExist(err) { return errors.Errorf("invalid output path: directory %q does not exist", dir) } } // check whether `path` points to a regular file // (if the path exists and do...
[ "func", "ValidateOutputPath", "(", "path", "string", ")", "error", "{", "dir", ":=", "filepath", ".", "Dir", "(", "path", ")", "\n", "if", "dir", "!=", "\"", "\"", "&&", "dir", "!=", "\"", "\"", "{", "if", "_", ",", "err", ":=", "os", ".", "Stat"...
// ValidateOutputPath validates the output paths of the `export` and `save` commands.
[ "ValidateOutputPath", "validates", "the", "output", "paths", "of", "the", "export", "and", "save", "commands", "." ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/utils.go#L132-L151
train
docker/cli
cli/command/utils.go
ValidateOutputPathFileMode
func ValidateOutputPathFileMode(fileMode os.FileMode) error { switch { case fileMode&os.ModeDevice != 0: return errors.New("got a device") case fileMode&os.ModeIrregular != 0: return errors.New("got an irregular file") } return nil }
go
func ValidateOutputPathFileMode(fileMode os.FileMode) error { switch { case fileMode&os.ModeDevice != 0: return errors.New("got a device") case fileMode&os.ModeIrregular != 0: return errors.New("got an irregular file") } return nil }
[ "func", "ValidateOutputPathFileMode", "(", "fileMode", "os", ".", "FileMode", ")", "error", "{", "switch", "{", "case", "fileMode", "&", "os", ".", "ModeDevice", "!=", "0", ":", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "case", "fileMod...
// ValidateOutputPathFileMode validates the output paths of the `cp` command and serves as a // helper to `ValidateOutputPath`
[ "ValidateOutputPathFileMode", "validates", "the", "output", "paths", "of", "the", "cp", "command", "and", "serves", "as", "a", "helper", "to", "ValidateOutputPath" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/utils.go#L155-L163
train
docker/cli
cli/command/system/df.go
newDiskUsageCommand
func newDiskUsageCommand(dockerCli command.Cli) *cobra.Command { var opts diskUsageOptions cmd := &cobra.Command{ Use: "df [OPTIONS]", Short: "Show docker disk usage", Args: cli.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { return runDiskUsage(dockerCli, opts) }, Annotations: map[st...
go
func newDiskUsageCommand(dockerCli command.Cli) *cobra.Command { var opts diskUsageOptions cmd := &cobra.Command{ Use: "df [OPTIONS]", Short: "Show docker disk usage", Args: cli.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { return runDiskUsage(dockerCli, opts) }, Annotations: map[st...
[ "func", "newDiskUsageCommand", "(", "dockerCli", "command", ".", "Cli", ")", "*", "cobra", ".", "Command", "{", "var", "opts", "diskUsageOptions", "\n\n", "cmd", ":=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"", "\"", ",", "Short", ":", "\"", ...
// newDiskUsageCommand creates a new cobra.Command for `docker df`
[ "newDiskUsageCommand", "creates", "a", "new", "cobra", ".", "Command", "for", "docker", "df" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/system/df.go#L18-L37
train
docker/cli
cli/streams/in.go
CheckTty
func (i *In) CheckTty(attachStdin, ttyMode bool) error { // In order to attach to a container tty, input stream for the client must // be a tty itself: redirecting or piping the client standard input is // incompatible with `docker run -t`, `docker exec -t` or `docker attach`. if ttyMode && attachStdin && !i.isTerm...
go
func (i *In) CheckTty(attachStdin, ttyMode bool) error { // In order to attach to a container tty, input stream for the client must // be a tty itself: redirecting or piping the client standard input is // incompatible with `docker run -t`, `docker exec -t` or `docker attach`. if ttyMode && attachStdin && !i.isTerm...
[ "func", "(", "i", "*", "In", ")", "CheckTty", "(", "attachStdin", ",", "ttyMode", "bool", ")", "error", "{", "// In order to attach to a container tty, input stream for the client must", "// be a tty itself: redirecting or piping the client standard input is", "// incompatible with...
// CheckTty checks if we are trying to attach to a container tty // from a non-tty client input stream, and if so, returns an error.
[ "CheckTty", "checks", "if", "we", "are", "trying", "to", "attach", "to", "a", "container", "tty", "from", "a", "non", "-", "tty", "client", "input", "stream", "and", "if", "so", "returns", "an", "error", "." ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/streams/in.go#L38-L50
train
docker/cli
cli/streams/in.go
NewIn
func NewIn(in io.ReadCloser) *In { fd, isTerminal := term.GetFdInfo(in) return &In{commonStream: commonStream{fd: fd, isTerminal: isTerminal}, in: in} }
go
func NewIn(in io.ReadCloser) *In { fd, isTerminal := term.GetFdInfo(in) return &In{commonStream: commonStream{fd: fd, isTerminal: isTerminal}, in: in} }
[ "func", "NewIn", "(", "in", "io", ".", "ReadCloser", ")", "*", "In", "{", "fd", ",", "isTerminal", ":=", "term", ".", "GetFdInfo", "(", "in", ")", "\n", "return", "&", "In", "{", "commonStream", ":", "commonStream", "{", "fd", ":", "fd", ",", "isTe...
// NewIn returns a new In object from a ReadCloser
[ "NewIn", "returns", "a", "new", "In", "object", "from", "a", "ReadCloser" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/streams/in.go#L53-L56
train
docker/cli
templates/templates.go
New
func New(tag string) *template.Template { return template.New(tag).Funcs(basicFunctions) }
go
func New(tag string) *template.Template { return template.New(tag).Funcs(basicFunctions) }
[ "func", "New", "(", "tag", "string", ")", "*", "template", ".", "Template", "{", "return", "template", ".", "New", "(", "tag", ")", ".", "Funcs", "(", "basicFunctions", ")", "\n", "}" ]
// New creates a new empty template with the provided tag and built-in // template functions.
[ "New", "creates", "a", "new", "empty", "template", "with", "the", "provided", "tag", "and", "built", "-", "in", "template", "functions", "." ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/templates/templates.go#L60-L62
train
docker/cli
cli/command/service/logs.go
parseContext
func (lw *logWriter) parseContext(details map[string]string) (logContext, error) { nodeID, ok := details["com.docker.swarm.node.id"] if !ok { return logContext{}, errors.Errorf("missing node id in details: %v", details) } delete(details, "com.docker.swarm.node.id") serviceID, ok := details["com.docker.swarm.ser...
go
func (lw *logWriter) parseContext(details map[string]string) (logContext, error) { nodeID, ok := details["com.docker.swarm.node.id"] if !ok { return logContext{}, errors.Errorf("missing node id in details: %v", details) } delete(details, "com.docker.swarm.node.id") serviceID, ok := details["com.docker.swarm.ser...
[ "func", "(", "lw", "*", "logWriter", ")", "parseContext", "(", "details", "map", "[", "string", "]", "string", ")", "(", "logContext", ",", "error", ")", "{", "nodeID", ",", "ok", ":=", "details", "[", "\"", "\"", "]", "\n", "if", "!", "ok", "{", ...
// parseContext returns a log context and REMOVES the context from the details map
[ "parseContext", "returns", "a", "log", "context", "and", "REMOVES", "the", "context", "from", "the", "details", "map" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/service/logs.go#L319-L343
train
docker/cli
cli/context/store/store.go
New
func New(dir string, cfg Config) Store { metaRoot := filepath.Join(dir, metadataDir) tlsRoot := filepath.Join(dir, tlsDir) return &store{ meta: &metadataStore{ root: metaRoot, config: cfg, }, tls: &tlsStore{ root: tlsRoot, }, } }
go
func New(dir string, cfg Config) Store { metaRoot := filepath.Join(dir, metadataDir) tlsRoot := filepath.Join(dir, tlsDir) return &store{ meta: &metadataStore{ root: metaRoot, config: cfg, }, tls: &tlsStore{ root: tlsRoot, }, } }
[ "func", "New", "(", "dir", "string", ",", "cfg", "Config", ")", "Store", "{", "metaRoot", ":=", "filepath", ".", "Join", "(", "dir", ",", "metadataDir", ")", "\n", "tlsRoot", ":=", "filepath", ".", "Join", "(", "dir", ",", "tlsDir", ")", "\n\n", "ret...
// New creates a store from a given directory. // If the directory does not exist or is empty, initialize it
[ "New", "creates", "a", "store", "from", "a", "given", "directory", ".", "If", "the", "directory", "does", "not", "exist", "or", "is", "empty", "initialize", "it" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/context/store/store.go#L89-L102
train
docker/cli
cli/context/store/store.go
Import
func Import(name string, s Writer, reader io.Reader) error { tr := tar.NewReader(reader) tlsData := ContextTLSData{ Endpoints: map[string]EndpointTLSData{}, } for { hdr, err := tr.Next() if err == io.EOF { break } if err != nil { return err } if hdr.Typeflag == tar.TypeDir { // skip this entr...
go
func Import(name string, s Writer, reader io.Reader) error { tr := tar.NewReader(reader) tlsData := ContextTLSData{ Endpoints: map[string]EndpointTLSData{}, } for { hdr, err := tr.Next() if err == io.EOF { break } if err != nil { return err } if hdr.Typeflag == tar.TypeDir { // skip this entr...
[ "func", "Import", "(", "name", "string", ",", "s", "Writer", ",", "reader", "io", ".", "Reader", ")", "error", "{", "tr", ":=", "tar", ".", "NewReader", "(", "reader", ")", "\n", "tlsData", ":=", "ContextTLSData", "{", "Endpoints", ":", "map", "[", "...
// Import imports an exported context into a store
[ "Import", "imports", "an", "exported", "context", "into", "a", "store" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/context/store/store.go#L263-L314
train
docker/cli
cli/command/trust/formatter.go
TagWrite
func TagWrite(ctx formatter.Context, signedTagInfoList []SignedTagInfo) error { render := func(format func(subContext formatter.SubContext) error) error { for _, signedTag := range signedTagInfoList { if err := format(&trustTagContext{s: signedTag}); err != nil { return err } } return nil } trustTagC...
go
func TagWrite(ctx formatter.Context, signedTagInfoList []SignedTagInfo) error { render := func(format func(subContext formatter.SubContext) error) error { for _, signedTag := range signedTagInfoList { if err := format(&trustTagContext{s: signedTag}); err != nil { return err } } return nil } trustTagC...
[ "func", "TagWrite", "(", "ctx", "formatter", ".", "Context", ",", "signedTagInfoList", "[", "]", "SignedTagInfo", ")", "error", "{", "render", ":=", "func", "(", "format", "func", "(", "subContext", "formatter", ".", "SubContext", ")", "error", ")", "error",...
// TagWrite writes the context
[ "TagWrite", "writes", "the", "context" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/trust/formatter.go#L50-L66
train
docker/cli
cli/command/trust/formatter.go
Signers
func (c *trustTagContext) Signers() string { sort.Strings(c.s.Signers) return strings.Join(c.s.Signers, ", ") }
go
func (c *trustTagContext) Signers() string { sort.Strings(c.s.Signers) return strings.Join(c.s.Signers, ", ") }
[ "func", "(", "c", "*", "trustTagContext", ")", "Signers", "(", ")", "string", "{", "sort", ".", "Strings", "(", "c", ".", "s", ".", "Signers", ")", "\n", "return", "strings", ".", "Join", "(", "c", ".", "s", ".", "Signers", ",", "\"", "\"", ")", ...
// Signers returns the sorted list of entities who signed this tag
[ "Signers", "returns", "the", "sorted", "list", "of", "entities", "who", "signed", "this", "tag" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/trust/formatter.go#L84-L87
train
docker/cli
cli/command/trust/formatter.go
SignerInfoWrite
func SignerInfoWrite(ctx formatter.Context, signerInfoList []SignerInfo) error { render := func(format func(subContext formatter.SubContext) error) error { for _, signerInfo := range signerInfoList { if err := format(&signerInfoContext{ trunc: ctx.Trunc, s: signerInfo, }); err != nil { return e...
go
func SignerInfoWrite(ctx formatter.Context, signerInfoList []SignerInfo) error { render := func(format func(subContext formatter.SubContext) error) error { for _, signerInfo := range signerInfoList { if err := format(&signerInfoContext{ trunc: ctx.Trunc, s: signerInfo, }); err != nil { return e...
[ "func", "SignerInfoWrite", "(", "ctx", "formatter", ".", "Context", ",", "signerInfoList", "[", "]", "SignerInfo", ")", "error", "{", "render", ":=", "func", "(", "format", "func", "(", "subContext", "formatter", ".", "SubContext", ")", "error", ")", "error"...
// SignerInfoWrite writes the context
[ "SignerInfoWrite", "writes", "the", "context" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/trust/formatter.go#L90-L108
train
docker/cli
cli/command/trust/formatter.go
Keys
func (c *signerInfoContext) Keys() string { sort.Strings(c.s.Keys) truncatedKeys := []string{} if c.trunc { for _, keyID := range c.s.Keys { truncatedKeys = append(truncatedKeys, stringid.TruncateID(keyID)) } return strings.Join(truncatedKeys, ", ") } return strings.Join(c.s.Keys, ", ") }
go
func (c *signerInfoContext) Keys() string { sort.Strings(c.s.Keys) truncatedKeys := []string{} if c.trunc { for _, keyID := range c.s.Keys { truncatedKeys = append(truncatedKeys, stringid.TruncateID(keyID)) } return strings.Join(truncatedKeys, ", ") } return strings.Join(c.s.Keys, ", ") }
[ "func", "(", "c", "*", "signerInfoContext", ")", "Keys", "(", ")", "string", "{", "sort", ".", "Strings", "(", "c", ".", "s", ".", "Keys", ")", "\n", "truncatedKeys", ":=", "[", "]", "string", "{", "}", "\n", "if", "c", ".", "trunc", "{", "for", ...
// Keys returns the sorted list of keys associated with the signer
[ "Keys", "returns", "the", "sorted", "list", "of", "keys", "associated", "with", "the", "signer" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/trust/formatter.go#L117-L127
train
docker/cli
cli/command/container/cmd.go
NewContainerCommand
func NewContainerCommand(dockerCli command.Cli) *cobra.Command { cmd := &cobra.Command{ Use: "container", Short: "Manage containers", Args: cli.NoArgs, RunE: command.ShowHelp(dockerCli.Err()), } cmd.AddCommand( NewAttachCommand(dockerCli), NewCommitCommand(dockerCli), NewCopyCommand(dockerCli), N...
go
func NewContainerCommand(dockerCli command.Cli) *cobra.Command { cmd := &cobra.Command{ Use: "container", Short: "Manage containers", Args: cli.NoArgs, RunE: command.ShowHelp(dockerCli.Err()), } cmd.AddCommand( NewAttachCommand(dockerCli), NewCommitCommand(dockerCli), NewCopyCommand(dockerCli), N...
[ "func", "NewContainerCommand", "(", "dockerCli", "command", ".", "Cli", ")", "*", "cobra", ".", "Command", "{", "cmd", ":=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"", "\"", ",", "Short", ":", "\"", "\"", ",", "Args", ":", "cli", ".", "No...
// NewContainerCommand returns a cobra command for `container` subcommands
[ "NewContainerCommand", "returns", "a", "cobra", "command", "for", "container", "subcommands" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/container/cmd.go#L10-L45
train
docker/cli
cli/command/config/ls.go
RunConfigList
func RunConfigList(dockerCli command.Cli, options ListOptions) error { client := dockerCli.Client() ctx := context.Background() configs, err := client.ConfigList(ctx, types.ConfigListOptions{Filters: options.Filter.Value()}) if err != nil { return err } format := options.Format if len(format) == 0 { if len...
go
func RunConfigList(dockerCli command.Cli, options ListOptions) error { client := dockerCli.Client() ctx := context.Background() configs, err := client.ConfigList(ctx, types.ConfigListOptions{Filters: options.Filter.Value()}) if err != nil { return err } format := options.Format if len(format) == 0 { if len...
[ "func", "RunConfigList", "(", "dockerCli", "command", ".", "Cli", ",", "options", "ListOptions", ")", "error", "{", "client", ":=", "dockerCli", ".", "Client", "(", ")", "\n", "ctx", ":=", "context", ".", "Background", "(", ")", "\n\n", "configs", ",", "...
// RunConfigList lists Swarm configs.
[ "RunConfigList", "lists", "Swarm", "configs", "." ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/config/ls.go#L45-L72
train
docker/cli
cli/config/credentials/default_store.go
DetectDefaultStore
func DetectDefaultStore(store string) string { platformDefault := defaultCredentialsStore() // user defined or no default for platform if store != "" || platformDefault == "" { return store } if _, err := exec.LookPath(remoteCredentialsPrefix + platformDefault); err == nil { return platformDefault } return...
go
func DetectDefaultStore(store string) string { platformDefault := defaultCredentialsStore() // user defined or no default for platform if store != "" || platformDefault == "" { return store } if _, err := exec.LookPath(remoteCredentialsPrefix + platformDefault); err == nil { return platformDefault } return...
[ "func", "DetectDefaultStore", "(", "store", "string", ")", "string", "{", "platformDefault", ":=", "defaultCredentialsStore", "(", ")", "\n\n", "// user defined or no default for platform", "if", "store", "!=", "\"", "\"", "||", "platformDefault", "==", "\"", "\"", ...
// DetectDefaultStore return the default credentials store for the platform if // the store executable is available.
[ "DetectDefaultStore", "return", "the", "default", "credentials", "store", "for", "the", "platform", "if", "the", "store", "executable", "is", "available", "." ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/config/credentials/default_store.go#L9-L21
train
docker/cli
cli/command/image/pull.go
NewPullCommand
func NewPullCommand(dockerCli command.Cli) *cobra.Command { var opts PullOptions cmd := &cobra.Command{ Use: "pull [OPTIONS] NAME[:TAG|@DIGEST]", Short: "Pull an image or a repository from a registry", Args: cli.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { opts.remote = args[0] ...
go
func NewPullCommand(dockerCli command.Cli) *cobra.Command { var opts PullOptions cmd := &cobra.Command{ Use: "pull [OPTIONS] NAME[:TAG|@DIGEST]", Short: "Pull an image or a repository from a registry", Args: cli.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { opts.remote = args[0] ...
[ "func", "NewPullCommand", "(", "dockerCli", "command", ".", "Cli", ")", "*", "cobra", ".", "Command", "{", "var", "opts", "PullOptions", "\n\n", "cmd", ":=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"", "\"", ",", "Short", ":", "\"", "\"", ",...
// NewPullCommand creates a new `docker pull` command
[ "NewPullCommand", "creates", "a", "new", "docker", "pull", "command" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/image/pull.go#L26-L48
train
docker/cli
cli/command/image/pull.go
RunPull
func RunPull(cli command.Cli, opts PullOptions) error { distributionRef, err := reference.ParseNormalizedNamed(opts.remote) switch { case err != nil: return err case opts.all && !reference.IsNameOnly(distributionRef): return errors.New("tag can't be used with --all-tags/-a") case !opts.all && reference.IsNameO...
go
func RunPull(cli command.Cli, opts PullOptions) error { distributionRef, err := reference.ParseNormalizedNamed(opts.remote) switch { case err != nil: return err case opts.all && !reference.IsNameOnly(distributionRef): return errors.New("tag can't be used with --all-tags/-a") case !opts.all && reference.IsNameO...
[ "func", "RunPull", "(", "cli", "command", ".", "Cli", ",", "opts", "PullOptions", ")", "error", "{", "distributionRef", ",", "err", ":=", "reference", ".", "ParseNormalizedNamed", "(", "opts", ".", "remote", ")", "\n", "switch", "{", "case", "err", "!=", ...
// RunPull performs a pull against the engine based on the specified options
[ "RunPull", "performs", "a", "pull", "against", "the", "engine", "based", "on", "the", "specified", "options" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/image/pull.go#L51-L86
train
docker/cli
cli/command/registry/logout.go
NewLogoutCommand
func NewLogoutCommand(dockerCli command.Cli) *cobra.Command { cmd := &cobra.Command{ Use: "logout [SERVER]", Short: "Log out from a Docker registry", Long: "Log out from a Docker registry.\nIf no server is specified, the default is defined by the daemon.", Args: cli.RequiresMaxArgs(1), RunE: func(cmd *co...
go
func NewLogoutCommand(dockerCli command.Cli) *cobra.Command { cmd := &cobra.Command{ Use: "logout [SERVER]", Short: "Log out from a Docker registry", Long: "Log out from a Docker registry.\nIf no server is specified, the default is defined by the daemon.", Args: cli.RequiresMaxArgs(1), RunE: func(cmd *co...
[ "func", "NewLogoutCommand", "(", "dockerCli", "command", ".", "Cli", ")", "*", "cobra", ".", "Command", "{", "cmd", ":=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"", "\"", ",", "Short", ":", "\"", "\"", ",", "Long", ":", "\"", "\\n", "\"",...
// NewLogoutCommand creates a new `docker logout` command
[ "NewLogoutCommand", "creates", "a", "new", "docker", "logout", "command" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/registry/logout.go#L14-L30
train
docker/cli
cli/command/cli_options.go
WithStandardStreams
func WithStandardStreams() DockerCliOption { return func(cli *DockerCli) error { // Set terminal emulation based on platform as required. stdin, stdout, stderr := term.StdStreams() cli.in = streams.NewIn(stdin) cli.out = streams.NewOut(stdout) cli.err = stderr return nil } }
go
func WithStandardStreams() DockerCliOption { return func(cli *DockerCli) error { // Set terminal emulation based on platform as required. stdin, stdout, stderr := term.StdStreams() cli.in = streams.NewIn(stdin) cli.out = streams.NewOut(stdout) cli.err = stderr return nil } }
[ "func", "WithStandardStreams", "(", ")", "DockerCliOption", "{", "return", "func", "(", "cli", "*", "DockerCli", ")", "error", "{", "// Set terminal emulation based on platform as required.", "stdin", ",", "stdout", ",", "stderr", ":=", "term", ".", "StdStreams", "(...
// WithStandardStreams sets a cli in, out and err streams with the standard streams.
[ "WithStandardStreams", "sets", "a", "cli", "in", "out", "and", "err", "streams", "with", "the", "standard", "streams", "." ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/cli_options.go#L21-L30
train
docker/cli
cli/command/cli_options.go
WithCombinedStreams
func WithCombinedStreams(combined io.Writer) DockerCliOption { return func(cli *DockerCli) error { cli.out = streams.NewOut(combined) cli.err = combined return nil } }
go
func WithCombinedStreams(combined io.Writer) DockerCliOption { return func(cli *DockerCli) error { cli.out = streams.NewOut(combined) cli.err = combined return nil } }
[ "func", "WithCombinedStreams", "(", "combined", "io", ".", "Writer", ")", "DockerCliOption", "{", "return", "func", "(", "cli", "*", "DockerCli", ")", "error", "{", "cli", ".", "out", "=", "streams", ".", "NewOut", "(", "combined", ")", "\n", "cli", ".",...
// WithCombinedStreams uses the same stream for the output and error streams.
[ "WithCombinedStreams", "uses", "the", "same", "stream", "for", "the", "output", "and", "error", "streams", "." ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/cli_options.go#L33-L39
train
docker/cli
cli/command/cli_options.go
WithInputStream
func WithInputStream(in io.ReadCloser) DockerCliOption { return func(cli *DockerCli) error { cli.in = streams.NewIn(in) return nil } }
go
func WithInputStream(in io.ReadCloser) DockerCliOption { return func(cli *DockerCli) error { cli.in = streams.NewIn(in) return nil } }
[ "func", "WithInputStream", "(", "in", "io", ".", "ReadCloser", ")", "DockerCliOption", "{", "return", "func", "(", "cli", "*", "DockerCli", ")", "error", "{", "cli", ".", "in", "=", "streams", ".", "NewIn", "(", "in", ")", "\n", "return", "nil", "\n", ...
// WithInputStream sets a cli input stream.
[ "WithInputStream", "sets", "a", "cli", "input", "stream", "." ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/cli_options.go#L42-L47
train
docker/cli
cli/command/cli_options.go
WithOutputStream
func WithOutputStream(out io.Writer) DockerCliOption { return func(cli *DockerCli) error { cli.out = streams.NewOut(out) return nil } }
go
func WithOutputStream(out io.Writer) DockerCliOption { return func(cli *DockerCli) error { cli.out = streams.NewOut(out) return nil } }
[ "func", "WithOutputStream", "(", "out", "io", ".", "Writer", ")", "DockerCliOption", "{", "return", "func", "(", "cli", "*", "DockerCli", ")", "error", "{", "cli", ".", "out", "=", "streams", ".", "NewOut", "(", "out", ")", "\n", "return", "nil", "\n",...
// WithOutputStream sets a cli output stream.
[ "WithOutputStream", "sets", "a", "cli", "output", "stream", "." ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/cli_options.go#L50-L55
train
docker/cli
cli/command/cli_options.go
WithErrorStream
func WithErrorStream(err io.Writer) DockerCliOption { return func(cli *DockerCli) error { cli.err = err return nil } }
go
func WithErrorStream(err io.Writer) DockerCliOption { return func(cli *DockerCli) error { cli.err = err return nil } }
[ "func", "WithErrorStream", "(", "err", "io", ".", "Writer", ")", "DockerCliOption", "{", "return", "func", "(", "cli", "*", "DockerCli", ")", "error", "{", "cli", ".", "err", "=", "err", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// WithErrorStream sets a cli error stream.
[ "WithErrorStream", "sets", "a", "cli", "error", "stream", "." ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/cli_options.go#L58-L63
train
docker/cli
cli/command/cli_options.go
WithContentTrustFromEnv
func WithContentTrustFromEnv() DockerCliOption { return func(cli *DockerCli) error { cli.contentTrust = false if e := os.Getenv("DOCKER_CONTENT_TRUST"); e != "" { if t, err := strconv.ParseBool(e); t || err != nil { // treat any other value as true cli.contentTrust = true } } return nil } }
go
func WithContentTrustFromEnv() DockerCliOption { return func(cli *DockerCli) error { cli.contentTrust = false if e := os.Getenv("DOCKER_CONTENT_TRUST"); e != "" { if t, err := strconv.ParseBool(e); t || err != nil { // treat any other value as true cli.contentTrust = true } } return nil } }
[ "func", "WithContentTrustFromEnv", "(", ")", "DockerCliOption", "{", "return", "func", "(", "cli", "*", "DockerCli", ")", "error", "{", "cli", ".", "contentTrust", "=", "false", "\n", "if", "e", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", ";", "e"...
// WithContentTrustFromEnv enables content trust on a cli from environment variable DOCKER_CONTENT_TRUST value.
[ "WithContentTrustFromEnv", "enables", "content", "trust", "on", "a", "cli", "from", "environment", "variable", "DOCKER_CONTENT_TRUST", "value", "." ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/cli_options.go#L66-L77
train
docker/cli
cli/command/cli_options.go
WithContentTrust
func WithContentTrust(enabled bool) DockerCliOption { return func(cli *DockerCli) error { cli.contentTrust = enabled return nil } }
go
func WithContentTrust(enabled bool) DockerCliOption { return func(cli *DockerCli) error { cli.contentTrust = enabled return nil } }
[ "func", "WithContentTrust", "(", "enabled", "bool", ")", "DockerCliOption", "{", "return", "func", "(", "cli", "*", "DockerCli", ")", "error", "{", "cli", ".", "contentTrust", "=", "enabled", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// WithContentTrust enables content trust on a cli.
[ "WithContentTrust", "enables", "content", "trust", "on", "a", "cli", "." ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/cli_options.go#L80-L85
train
docker/cli
cli/command/cli_options.go
WithContainerizedClient
func WithContainerizedClient(containerizedFn func(string) (clitypes.ContainerizedClient, error)) DockerCliOption { return func(cli *DockerCli) error { cli.newContainerizeClient = containerizedFn return nil } }
go
func WithContainerizedClient(containerizedFn func(string) (clitypes.ContainerizedClient, error)) DockerCliOption { return func(cli *DockerCli) error { cli.newContainerizeClient = containerizedFn return nil } }
[ "func", "WithContainerizedClient", "(", "containerizedFn", "func", "(", "string", ")", "(", "clitypes", ".", "ContainerizedClient", ",", "error", ")", ")", "DockerCliOption", "{", "return", "func", "(", "cli", "*", "DockerCli", ")", "error", "{", "cli", ".", ...
// WithContainerizedClient sets the containerized client constructor on a cli.
[ "WithContainerizedClient", "sets", "the", "containerized", "client", "constructor", "on", "a", "cli", "." ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/cli_options.go#L88-L93
train
docker/cli
cli/command/cli_options.go
WithContextEndpointType
func WithContextEndpointType(endpointName string, endpointType store.TypeGetter) DockerCliOption { return func(cli *DockerCli) error { switch endpointName { case docker.DockerEndpoint, kubernetes.KubernetesEndpoint: return fmt.Errorf("cannot change %q endpoint type", endpointName) } cli.contextStoreConfig.S...
go
func WithContextEndpointType(endpointName string, endpointType store.TypeGetter) DockerCliOption { return func(cli *DockerCli) error { switch endpointName { case docker.DockerEndpoint, kubernetes.KubernetesEndpoint: return fmt.Errorf("cannot change %q endpoint type", endpointName) } cli.contextStoreConfig.S...
[ "func", "WithContextEndpointType", "(", "endpointName", "string", ",", "endpointType", "store", ".", "TypeGetter", ")", "DockerCliOption", "{", "return", "func", "(", "cli", "*", "DockerCli", ")", "error", "{", "switch", "endpointName", "{", "case", "docker", "....
// WithContextEndpointType add support for an additional typed endpoint in the context store // Plugins should use this to store additional endpoints configuration in the context store
[ "WithContextEndpointType", "add", "support", "for", "an", "additional", "typed", "endpoint", "in", "the", "context", "store", "Plugins", "should", "use", "this", "to", "store", "additional", "endpoints", "configuration", "in", "the", "context", "store" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/cli_options.go#L97-L106
train
docker/cli
cli/command/system/version.go
NewVersionCommand
func NewVersionCommand(dockerCli command.Cli) *cobra.Command { var opts versionOptions cmd := &cobra.Command{ Use: "version [OPTIONS]", Short: "Show the Docker version information", Args: cli.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { return runVersion(dockerCli, &opts) }, } fla...
go
func NewVersionCommand(dockerCli command.Cli) *cobra.Command { var opts versionOptions cmd := &cobra.Command{ Use: "version [OPTIONS]", Short: "Show the Docker version information", Args: cli.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { return runVersion(dockerCli, &opts) }, } fla...
[ "func", "NewVersionCommand", "(", "dockerCli", "command", ".", "Cli", ")", "*", "cobra", ".", "Command", "{", "var", "opts", "versionOptions", "\n\n", "cmd", ":=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"", "\"", ",", "Short", ":", "\"", "\""...
// NewVersionCommand creates a new cobra.Command for `docker version`
[ "NewVersionCommand", "creates", "a", "new", "cobra", ".", "Command", "for", "docker", "version" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/system/version.go#L97-L115
train
docker/cli
cli/command/swarm/progress/root_rotation.go
RootRotationProgress
func RootRotationProgress(ctx context.Context, dclient client.APIClient, progressWriter io.WriteCloser) error { defer progressWriter.Close() progressOut := streamformatter.NewJSONProgressOutput(progressWriter, false) sigint := make(chan os.Signal, 1) signal.Notify(sigint, os.Interrupt) defer signal.Stop(sigint) ...
go
func RootRotationProgress(ctx context.Context, dclient client.APIClient, progressWriter io.WriteCloser) error { defer progressWriter.Close() progressOut := streamformatter.NewJSONProgressOutput(progressWriter, false) sigint := make(chan os.Signal, 1) signal.Notify(sigint, os.Interrupt) defer signal.Stop(sigint) ...
[ "func", "RootRotationProgress", "(", "ctx", "context", ".", "Context", ",", "dclient", "client", ".", "APIClient", ",", "progressWriter", "io", ".", "WriteCloser", ")", "error", "{", "defer", "progressWriter", ".", "Close", "(", ")", "\n\n", "progressOut", ":=...
// RootRotationProgress outputs progress information for convergence of a root rotation.
[ "RootRotationProgress", "outputs", "progress", "information", "for", "convergence", "of", "a", "root", "rotation", "." ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/swarm/progress/root_rotation.go#L29-L72
train
docker/cli
internal/containerizedengine/update.go
ActivateEngine
func (c *baseClient) ActivateEngine(ctx context.Context, opts clitypes.EngineInitOptions, out clitypes.OutStream, authConfig *types.AuthConfig) error { // If the user didn't specify an image, determine the correct enterprise image to use if opts.EngineImage == "" { localMetadata, err := versions.GetCurrentRuntime...
go
func (c *baseClient) ActivateEngine(ctx context.Context, opts clitypes.EngineInitOptions, out clitypes.OutStream, authConfig *types.AuthConfig) error { // If the user didn't specify an image, determine the correct enterprise image to use if opts.EngineImage == "" { localMetadata, err := versions.GetCurrentRuntime...
[ "func", "(", "c", "*", "baseClient", ")", "ActivateEngine", "(", "ctx", "context", ".", "Context", ",", "opts", "clitypes", ".", "EngineInitOptions", ",", "out", "clitypes", ".", "OutStream", ",", "authConfig", "*", "types", ".", "AuthConfig", ")", "error", ...
// ActivateEngine will switch the image from the CE to EE image
[ "ActivateEngine", "will", "switch", "the", "image", "from", "the", "CE", "to", "EE", "image" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/internal/containerizedengine/update.go#L24-L48
train
docker/cli
internal/containerizedengine/update.go
DoUpdate
func (c *baseClient) DoUpdate(ctx context.Context, opts clitypes.EngineInitOptions, out clitypes.OutStream, authConfig *types.AuthConfig) error { ctx = namespaces.WithNamespace(ctx, engineNamespace) if opts.EngineVersion == "" { // TODO - Future enhancement: This could be improved to be // smart about figuring ...
go
func (c *baseClient) DoUpdate(ctx context.Context, opts clitypes.EngineInitOptions, out clitypes.OutStream, authConfig *types.AuthConfig) error { ctx = namespaces.WithNamespace(ctx, engineNamespace) if opts.EngineVersion == "" { // TODO - Future enhancement: This could be improved to be // smart about figuring ...
[ "func", "(", "c", "*", "baseClient", ")", "DoUpdate", "(", "ctx", "context", ".", "Context", ",", "opts", "clitypes", ".", "EngineInitOptions", ",", "out", "clitypes", ".", "OutStream", ",", "authConfig", "*", "types", ".", "AuthConfig", ")", "error", "{",...
// DoUpdate performs the underlying engine update
[ "DoUpdate", "performs", "the", "underlying", "engine", "update" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/internal/containerizedengine/update.go#L51-L104
train
docker/cli
internal/containerizedengine/update.go
getReleaseNotesURL
func getReleaseNotesURL(imageName string) string { versionTag := "" distributionRef, err := reference.ParseNormalizedNamed(imageName) if err == nil { taggedRef, ok := distributionRef.(reference.NamedTagged) if ok { versionTag = taggedRef.Tag() } } return fmt.Sprintf("%s/%s", clitypes.ReleaseNotePrefix, ve...
go
func getReleaseNotesURL(imageName string) string { versionTag := "" distributionRef, err := reference.ParseNormalizedNamed(imageName) if err == nil { taggedRef, ok := distributionRef.(reference.NamedTagged) if ok { versionTag = taggedRef.Tag() } } return fmt.Sprintf("%s/%s", clitypes.ReleaseNotePrefix, ve...
[ "func", "getReleaseNotesURL", "(", "imageName", "string", ")", "string", "{", "versionTag", ":=", "\"", "\"", "\n", "distributionRef", ",", "err", ":=", "reference", ".", "ParseNormalizedNamed", "(", "imageName", ")", "\n", "if", "err", "==", "nil", "{", "ta...
// getReleaseNotesURL returns a release notes url // If the image name does not contain a version tag, the base release notes URL is returned
[ "getReleaseNotesURL", "returns", "a", "release", "notes", "url", "If", "the", "image", "name", "does", "not", "contain", "a", "version", "tag", "the", "base", "release", "notes", "URL", "is", "returned" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/internal/containerizedengine/update.go#L173-L183
train
docker/cli
cli/command/context/import.go
RunImport
func RunImport(dockerCli command.Cli, name string, source string) error { if err := checkContextNameForCreation(dockerCli.ContextStore(), name); err != nil { return err } var reader io.Reader if source == "-" { reader = dockerCli.In() } else { f, err := os.Open(source) if err != nil { return err } d...
go
func RunImport(dockerCli command.Cli, name string, source string) error { if err := checkContextNameForCreation(dockerCli.ContextStore(), name); err != nil { return err } var reader io.Reader if source == "-" { reader = dockerCli.In() } else { f, err := os.Open(source) if err != nil { return err } d...
[ "func", "RunImport", "(", "dockerCli", "command", ".", "Cli", ",", "name", "string", ",", "source", "string", ")", "error", "{", "if", "err", ":=", "checkContextNameForCreation", "(", "dockerCli", ".", "ContextStore", "(", ")", ",", "name", ")", ";", "err"...
// RunImport imports a Docker context
[ "RunImport", "imports", "a", "Docker", "context" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/context/import.go#L27-L49
train
docker/cli
cli/command/registry/formatter_search.go
NewSearchFormat
func NewSearchFormat(source string) formatter.Format { switch source { case "": return defaultSearchTableFormat case formatter.TableFormatKey: return defaultSearchTableFormat } return formatter.Format(source) }
go
func NewSearchFormat(source string) formatter.Format { switch source { case "": return defaultSearchTableFormat case formatter.TableFormatKey: return defaultSearchTableFormat } return formatter.Format(source) }
[ "func", "NewSearchFormat", "(", "source", "string", ")", "formatter", ".", "Format", "{", "switch", "source", "{", "case", "\"", "\"", ":", "return", "defaultSearchTableFormat", "\n", "case", "formatter", ".", "TableFormatKey", ":", "return", "defaultSearchTableFo...
// NewSearchFormat returns a Format for rendering using a network Context
[ "NewSearchFormat", "returns", "a", "Format", "for", "rendering", "using", "a", "network", "Context" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/registry/formatter_search.go#L20-L28
train
docker/cli
cli/command/registry/formatter_search.go
SearchWrite
func SearchWrite(ctx formatter.Context, results []registry.SearchResult, auto bool, stars int) error { render := func(format func(subContext formatter.SubContext) error) error { for _, result := range results { // --automated and -s, --stars are deprecated since Docker 1.12 if (auto && !result.IsAutomated) || ...
go
func SearchWrite(ctx formatter.Context, results []registry.SearchResult, auto bool, stars int) error { render := func(format func(subContext formatter.SubContext) error) error { for _, result := range results { // --automated and -s, --stars are deprecated since Docker 1.12 if (auto && !result.IsAutomated) || ...
[ "func", "SearchWrite", "(", "ctx", "formatter", ".", "Context", ",", "results", "[", "]", "registry", ".", "SearchResult", ",", "auto", "bool", ",", "stars", "int", ")", "error", "{", "render", ":=", "func", "(", "format", "func", "(", "subContext", "for...
// SearchWrite writes the context
[ "SearchWrite", "writes", "the", "context" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/registry/formatter_search.go#L31-L54
train
docker/cli
cli/command/context.go
GetDockerContext
func GetDockerContext(storeMetadata store.Metadata) (DockerContext, error) { if storeMetadata.Metadata == nil { // can happen if we save endpoints before assigning a context metadata // it is totally valid, and we should return a default initialized value return DockerContext{}, nil } res, ok := storeMetadata....
go
func GetDockerContext(storeMetadata store.Metadata) (DockerContext, error) { if storeMetadata.Metadata == nil { // can happen if we save endpoints before assigning a context metadata // it is totally valid, and we should return a default initialized value return DockerContext{}, nil } res, ok := storeMetadata....
[ "func", "GetDockerContext", "(", "storeMetadata", "store", ".", "Metadata", ")", "(", "DockerContext", ",", "error", ")", "{", "if", "storeMetadata", ".", "Metadata", "==", "nil", "{", "// can happen if we save endpoints before assigning a context metadata", "// it is tot...
// GetDockerContext extracts metadata from stored context metadata
[ "GetDockerContext", "extracts", "metadata", "from", "stored", "context", "metadata" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/context.go#L16-L27
train
docker/cli
cli/command/stack/ps.go
RunPs
func RunPs(dockerCli command.Cli, flags *pflag.FlagSet, commonOrchestrator command.Orchestrator, opts options.PS) error { return runOrchestratedCommand(dockerCli, flags, commonOrchestrator, func() error { return swarm.RunPS(dockerCli, opts) }, func(kli *kubernetes.KubeCli) error { return kubernetes.RunPS(kli, opts...
go
func RunPs(dockerCli command.Cli, flags *pflag.FlagSet, commonOrchestrator command.Orchestrator, opts options.PS) error { return runOrchestratedCommand(dockerCli, flags, commonOrchestrator, func() error { return swarm.RunPS(dockerCli, opts) }, func(kli *kubernetes.KubeCli) error { return kubernetes.RunPS(kli, opts...
[ "func", "RunPs", "(", "dockerCli", "command", ".", "Cli", ",", "flags", "*", "pflag", ".", "FlagSet", ",", "commonOrchestrator", "command", ".", "Orchestrator", ",", "opts", "options", ".", "PS", ")", "error", "{", "return", "runOrchestratedCommand", "(", "d...
// RunPs performs a stack ps against the specified orchestrator
[ "RunPs", "performs", "a", "stack", "ps", "against", "the", "specified", "orchestrator" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/stack/ps.go#L40-L44
train
docker/cli
internal/pkg/containerized/pauseandrun.go
AtomicImageUpdate
func AtomicImageUpdate(ctx context.Context, container containerd.Container, image containerd.Image, healthcheckFn func() error) error { updateCompleted := false err := pauseAndRun(ctx, container, func() error { if err := container.Update(ctx, WithUpgrade(image)); err != nil { return errors.Wrap(err, "failed to u...
go
func AtomicImageUpdate(ctx context.Context, container containerd.Container, image containerd.Image, healthcheckFn func() error) error { updateCompleted := false err := pauseAndRun(ctx, container, func() error { if err := container.Update(ctx, WithUpgrade(image)); err != nil { return errors.Wrap(err, "failed to u...
[ "func", "AtomicImageUpdate", "(", "ctx", "context", ".", "Context", ",", "container", "containerd", ".", "Container", ",", "image", "containerd", ".", "Image", ",", "healthcheckFn", "func", "(", ")", "error", ")", "error", "{", "updateCompleted", ":=", "false"...
// AtomicImageUpdate will perform an update of the given container with the new image // and verify success via the provided healthcheckFn. If the healthcheck fails, the // container will be reverted to the prior image
[ "AtomicImageUpdate", "will", "perform", "an", "update", "of", "the", "given", "container", "with", "the", "new", "image", "and", "verify", "success", "via", "the", "provided", "healthcheckFn", ".", "If", "the", "healthcheck", "fails", "the", "container", "will",...
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/internal/pkg/containerized/pauseandrun.go#L15-L43
train
docker/cli
opts/throttledevice.go
ValidateThrottleBpsDevice
func ValidateThrottleBpsDevice(val string) (*blkiodev.ThrottleDevice, error) { split := strings.SplitN(val, ":", 2) if len(split) != 2 { return nil, fmt.Errorf("bad format: %s", val) } if !strings.HasPrefix(split[0], "/dev/") { return nil, fmt.Errorf("bad format for device path: %s", val) } rate, err := units...
go
func ValidateThrottleBpsDevice(val string) (*blkiodev.ThrottleDevice, error) { split := strings.SplitN(val, ":", 2) if len(split) != 2 { return nil, fmt.Errorf("bad format: %s", val) } if !strings.HasPrefix(split[0], "/dev/") { return nil, fmt.Errorf("bad format for device path: %s", val) } rate, err := units...
[ "func", "ValidateThrottleBpsDevice", "(", "val", "string", ")", "(", "*", "blkiodev", ".", "ThrottleDevice", ",", "error", ")", "{", "split", ":=", "strings", ".", "SplitN", "(", "val", ",", "\"", "\"", ",", "2", ")", "\n", "if", "len", "(", "split", ...
// ValidateThrottleBpsDevice validates that the specified string has a valid device-rate format.
[ "ValidateThrottleBpsDevice", "validates", "that", "the", "specified", "string", "has", "a", "valid", "device", "-", "rate", "format", "." ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/opts/throttledevice.go#L16-L36
train
docker/cli
opts/throttledevice.go
ValidateThrottleIOpsDevice
func ValidateThrottleIOpsDevice(val string) (*blkiodev.ThrottleDevice, error) { split := strings.SplitN(val, ":", 2) if len(split) != 2 { return nil, fmt.Errorf("bad format: %s", val) } if !strings.HasPrefix(split[0], "/dev/") { return nil, fmt.Errorf("bad format for device path: %s", val) } rate, err := strc...
go
func ValidateThrottleIOpsDevice(val string) (*blkiodev.ThrottleDevice, error) { split := strings.SplitN(val, ":", 2) if len(split) != 2 { return nil, fmt.Errorf("bad format: %s", val) } if !strings.HasPrefix(split[0], "/dev/") { return nil, fmt.Errorf("bad format for device path: %s", val) } rate, err := strc...
[ "func", "ValidateThrottleIOpsDevice", "(", "val", "string", ")", "(", "*", "blkiodev", ".", "ThrottleDevice", ",", "error", ")", "{", "split", ":=", "strings", ".", "SplitN", "(", "val", ",", "\"", "\"", ",", "2", ")", "\n", "if", "len", "(", "split", ...
// ValidateThrottleIOpsDevice validates that the specified string has a valid device-rate format.
[ "ValidateThrottleIOpsDevice", "validates", "that", "the", "specified", "string", "has", "a", "valid", "device", "-", "rate", "format", "." ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/opts/throttledevice.go#L39-L56
train
docker/cli
opts/throttledevice.go
NewThrottledeviceOpt
func NewThrottledeviceOpt(validator ValidatorThrottleFctType) ThrottledeviceOpt { values := []*blkiodev.ThrottleDevice{} return ThrottledeviceOpt{ values: values, validator: validator, } }
go
func NewThrottledeviceOpt(validator ValidatorThrottleFctType) ThrottledeviceOpt { values := []*blkiodev.ThrottleDevice{} return ThrottledeviceOpt{ values: values, validator: validator, } }
[ "func", "NewThrottledeviceOpt", "(", "validator", "ValidatorThrottleFctType", ")", "ThrottledeviceOpt", "{", "values", ":=", "[", "]", "*", "blkiodev", ".", "ThrottleDevice", "{", "}", "\n", "return", "ThrottledeviceOpt", "{", "values", ":", "values", ",", "valida...
// NewThrottledeviceOpt creates a new ThrottledeviceOpt
[ "NewThrottledeviceOpt", "creates", "a", "new", "ThrottledeviceOpt" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/opts/throttledevice.go#L65-L71
train
docker/cli
opts/throttledevice.go
Set
func (opt *ThrottledeviceOpt) Set(val string) error { var value *blkiodev.ThrottleDevice if opt.validator != nil { v, err := opt.validator(val) if err != nil { return err } value = v } (opt.values) = append((opt.values), value) return nil }
go
func (opt *ThrottledeviceOpt) Set(val string) error { var value *blkiodev.ThrottleDevice if opt.validator != nil { v, err := opt.validator(val) if err != nil { return err } value = v } (opt.values) = append((opt.values), value) return nil }
[ "func", "(", "opt", "*", "ThrottledeviceOpt", ")", "Set", "(", "val", "string", ")", "error", "{", "var", "value", "*", "blkiodev", ".", "ThrottleDevice", "\n", "if", "opt", ".", "validator", "!=", "nil", "{", "v", ",", "err", ":=", "opt", ".", "vali...
// Set validates a ThrottleDevice and sets its name as a key in ThrottledeviceOpt
[ "Set", "validates", "a", "ThrottleDevice", "and", "sets", "its", "name", "as", "a", "key", "in", "ThrottledeviceOpt" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/opts/throttledevice.go#L74-L85
train
docker/cli
opts/throttledevice.go
String
func (opt *ThrottledeviceOpt) String() string { var out []string for _, v := range opt.values { out = append(out, v.String()) } return fmt.Sprintf("%v", out) }
go
func (opt *ThrottledeviceOpt) String() string { var out []string for _, v := range opt.values { out = append(out, v.String()) } return fmt.Sprintf("%v", out) }
[ "func", "(", "opt", "*", "ThrottledeviceOpt", ")", "String", "(", ")", "string", "{", "var", "out", "[", "]", "string", "\n", "for", "_", ",", "v", ":=", "range", "opt", ".", "values", "{", "out", "=", "append", "(", "out", ",", "v", ".", "String...
// String returns ThrottledeviceOpt values as a string.
[ "String", "returns", "ThrottledeviceOpt", "values", "as", "a", "string", "." ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/opts/throttledevice.go#L88-L95
train
docker/cli
opts/throttledevice.go
GetList
func (opt *ThrottledeviceOpt) GetList() []*blkiodev.ThrottleDevice { var throttledevice []*blkiodev.ThrottleDevice throttledevice = append(throttledevice, opt.values...) return throttledevice }
go
func (opt *ThrottledeviceOpt) GetList() []*blkiodev.ThrottleDevice { var throttledevice []*blkiodev.ThrottleDevice throttledevice = append(throttledevice, opt.values...) return throttledevice }
[ "func", "(", "opt", "*", "ThrottledeviceOpt", ")", "GetList", "(", ")", "[", "]", "*", "blkiodev", ".", "ThrottleDevice", "{", "var", "throttledevice", "[", "]", "*", "blkiodev", ".", "ThrottleDevice", "\n", "throttledevice", "=", "append", "(", "throttledev...
// GetList returns a slice of pointers to ThrottleDevices.
[ "GetList", "returns", "a", "slice", "of", "pointers", "to", "ThrottleDevices", "." ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/opts/throttledevice.go#L98-L103
train
docker/cli
cli/command/container/stop.go
NewStopCommand
func NewStopCommand(dockerCli command.Cli) *cobra.Command { var opts stopOptions cmd := &cobra.Command{ Use: "stop [OPTIONS] CONTAINER [CONTAINER...]", Short: "Stop one or more running containers", Args: cli.RequiresMinArgs(1), RunE: func(cmd *cobra.Command, args []string) error { opts.containers = arg...
go
func NewStopCommand(dockerCli command.Cli) *cobra.Command { var opts stopOptions cmd := &cobra.Command{ Use: "stop [OPTIONS] CONTAINER [CONTAINER...]", Short: "Stop one or more running containers", Args: cli.RequiresMinArgs(1), RunE: func(cmd *cobra.Command, args []string) error { opts.containers = arg...
[ "func", "NewStopCommand", "(", "dockerCli", "command", ".", "Cli", ")", "*", "cobra", ".", "Command", "{", "var", "opts", "stopOptions", "\n\n", "cmd", ":=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"", "\"", ",", "Short", ":", "\"", "\"", ",...
// NewStopCommand creates a new cobra.Command for `docker stop`
[ "NewStopCommand", "creates", "a", "new", "cobra", ".", "Command", "for", "docker", "stop" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/container/stop.go#L23-L40
train
docker/cli
cli/command/stack/kubernetes/list.go
GetStacks
func GetStacks(kubeCli *KubeCli, opts options.List) ([]*formatter.Stack, error) { if opts.AllNamespaces || len(opts.Namespaces) == 0 { if isAllNamespacesDisabled(kubeCli.ConfigFile().Kubernetes) { opts.AllNamespaces = true } return getStacksWithAllNamespaces(kubeCli, opts) } return getStacksWithNamespaces(k...
go
func GetStacks(kubeCli *KubeCli, opts options.List) ([]*formatter.Stack, error) { if opts.AllNamespaces || len(opts.Namespaces) == 0 { if isAllNamespacesDisabled(kubeCli.ConfigFile().Kubernetes) { opts.AllNamespaces = true } return getStacksWithAllNamespaces(kubeCli, opts) } return getStacksWithNamespaces(k...
[ "func", "GetStacks", "(", "kubeCli", "*", "KubeCli", ",", "opts", "options", ".", "List", ")", "(", "[", "]", "*", "formatter", ".", "Stack", ",", "error", ")", "{", "if", "opts", ".", "AllNamespaces", "||", "len", "(", "opts", ".", "Namespaces", ")"...
// GetStacks lists the kubernetes stacks
[ "GetStacks", "lists", "the", "kubernetes", "stacks" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/stack/kubernetes/list.go#L21-L29
train
docker/cli
cli/registry/client/client.go
NewRegistryClient
func NewRegistryClient(resolver AuthConfigResolver, userAgent string, insecure bool) RegistryClient { return &client{ authConfigResolver: resolver, insecureRegistry: insecure, userAgent: userAgent, } }
go
func NewRegistryClient(resolver AuthConfigResolver, userAgent string, insecure bool) RegistryClient { return &client{ authConfigResolver: resolver, insecureRegistry: insecure, userAgent: userAgent, } }
[ "func", "NewRegistryClient", "(", "resolver", "AuthConfigResolver", ",", "userAgent", "string", ",", "insecure", "bool", ")", "RegistryClient", "{", "return", "&", "client", "{", "authConfigResolver", ":", "resolver", ",", "insecureRegistry", ":", "insecure", ",", ...
// NewRegistryClient returns a new RegistryClient with a resolver
[ "NewRegistryClient", "returns", "a", "new", "RegistryClient", "with", "a", "resolver" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/registry/client/client.go#L32-L38
train
docker/cli
cli/registry/client/client.go
MountBlob
func (c *client) MountBlob(ctx context.Context, sourceRef reference.Canonical, targetRef reference.Named) error { repoEndpoint, err := newDefaultRepositoryEndpoint(targetRef, c.insecureRegistry) if err != nil { return err } repo, err := c.getRepositoryForReference(ctx, targetRef, repoEndpoint) if err != nil { ...
go
func (c *client) MountBlob(ctx context.Context, sourceRef reference.Canonical, targetRef reference.Named) error { repoEndpoint, err := newDefaultRepositoryEndpoint(targetRef, c.insecureRegistry) if err != nil { return err } repo, err := c.getRepositoryForReference(ctx, targetRef, repoEndpoint) if err != nil { ...
[ "func", "(", "c", "*", "client", ")", "MountBlob", "(", "ctx", "context", ".", "Context", ",", "sourceRef", "reference", ".", "Canonical", ",", "targetRef", "reference", ".", "Named", ")", "error", "{", "repoEndpoint", ",", "err", ":=", "newDefaultRepository...
// MountBlob into the registry, so it can be referenced by a manifest
[ "MountBlob", "into", "the", "registry", "so", "it", "can", "be", "referenced", "by", "a", "manifest" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/registry/client/client.go#L78-L99
train
docker/cli
cli/registry/client/client.go
PutManifest
func (c *client) PutManifest(ctx context.Context, ref reference.Named, manifest distribution.Manifest) (digest.Digest, error) { repoEndpoint, err := newDefaultRepositoryEndpoint(ref, c.insecureRegistry) if err != nil { return digest.Digest(""), err } repo, err := c.getRepositoryForReference(ctx, ref, repoEndpoin...
go
func (c *client) PutManifest(ctx context.Context, ref reference.Named, manifest distribution.Manifest) (digest.Digest, error) { repoEndpoint, err := newDefaultRepositoryEndpoint(ref, c.insecureRegistry) if err != nil { return digest.Digest(""), err } repo, err := c.getRepositoryForReference(ctx, ref, repoEndpoin...
[ "func", "(", "c", "*", "client", ")", "PutManifest", "(", "ctx", "context", ".", "Context", ",", "ref", "reference", ".", "Named", ",", "manifest", "distribution", ".", "Manifest", ")", "(", "digest", ".", "Digest", ",", "error", ")", "{", "repoEndpoint"...
// PutManifest sends the manifest to a registry and returns the new digest
[ "PutManifest", "sends", "the", "manifest", "to", "a", "registry", "and", "returns", "the", "new", "digest" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/registry/client/client.go#L102-L125
train
docker/cli
cli/registry/client/client.go
GetManifest
func (c *client) GetManifest(ctx context.Context, ref reference.Named) (manifesttypes.ImageManifest, error) { var result manifesttypes.ImageManifest fetch := func(ctx context.Context, repo distribution.Repository, ref reference.Named) (bool, error) { var err error result, err = fetchManifest(ctx, repo, ref) ret...
go
func (c *client) GetManifest(ctx context.Context, ref reference.Named) (manifesttypes.ImageManifest, error) { var result manifesttypes.ImageManifest fetch := func(ctx context.Context, repo distribution.Repository, ref reference.Named) (bool, error) { var err error result, err = fetchManifest(ctx, repo, ref) ret...
[ "func", "(", "c", "*", "client", ")", "GetManifest", "(", "ctx", "context", ".", "Context", ",", "ref", "reference", ".", "Named", ")", "(", "manifesttypes", ".", "ImageManifest", ",", "error", ")", "{", "var", "result", "manifesttypes", ".", "ImageManifes...
// GetManifest returns an ImageManifest for the reference
[ "GetManifest", "returns", "an", "ImageManifest", "for", "the", "reference" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/registry/client/client.go#L164-L174
train
docker/cli
cli/registry/client/client.go
GetManifestList
func (c *client) GetManifestList(ctx context.Context, ref reference.Named) ([]manifesttypes.ImageManifest, error) { result := []manifesttypes.ImageManifest{} fetch := func(ctx context.Context, repo distribution.Repository, ref reference.Named) (bool, error) { var err error result, err = fetchList(ctx, repo, ref) ...
go
func (c *client) GetManifestList(ctx context.Context, ref reference.Named) ([]manifesttypes.ImageManifest, error) { result := []manifesttypes.ImageManifest{} fetch := func(ctx context.Context, repo distribution.Repository, ref reference.Named) (bool, error) { var err error result, err = fetchList(ctx, repo, ref) ...
[ "func", "(", "c", "*", "client", ")", "GetManifestList", "(", "ctx", "context", ".", "Context", ",", "ref", "reference", ".", "Named", ")", "(", "[", "]", "manifesttypes", ".", "ImageManifest", ",", "error", ")", "{", "result", ":=", "[", "]", "manifes...
// GetManifestList returns a list of ImageManifest for the reference
[ "GetManifestList", "returns", "a", "list", "of", "ImageManifest", "for", "the", "reference" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/registry/client/client.go#L177-L187
train
docker/cli
cli/registry/client/client.go
GetRegistryAuth
func GetRegistryAuth(ctx context.Context, resolver AuthConfigResolver, imageName string) (*types.AuthConfig, error) { distributionRef, err := reference.ParseNormalizedNamed(imageName) if err != nil { return nil, fmt.Errorf("Failed to parse image name: %s: %s", imageName, err) } imgRefAndAuth, err := trust.GetImag...
go
func GetRegistryAuth(ctx context.Context, resolver AuthConfigResolver, imageName string) (*types.AuthConfig, error) { distributionRef, err := reference.ParseNormalizedNamed(imageName) if err != nil { return nil, fmt.Errorf("Failed to parse image name: %s: %s", imageName, err) } imgRefAndAuth, err := trust.GetImag...
[ "func", "GetRegistryAuth", "(", "ctx", "context", ".", "Context", ",", "resolver", "AuthConfigResolver", ",", "imageName", "string", ")", "(", "*", "types", ".", "AuthConfig", ",", "error", ")", "{", "distributionRef", ",", "err", ":=", "reference", ".", "Pa...
// GetRegistryAuth returns the auth config given an input image
[ "GetRegistryAuth", "returns", "the", "auth", "config", "given", "an", "input", "image" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/registry/client/client.go#L201-L211
train
docker/cli
cli/command/container/opts.go
parseSecurityOpts
func parseSecurityOpts(securityOpts []string) ([]string, error) { for key, opt := range securityOpts { con := strings.SplitN(opt, "=", 2) if len(con) == 1 && con[0] != "no-new-privileges" { if strings.Contains(opt, ":") { con = strings.SplitN(opt, ":", 2) } else { return securityOpts, errors.Errorf("...
go
func parseSecurityOpts(securityOpts []string) ([]string, error) { for key, opt := range securityOpts { con := strings.SplitN(opt, "=", 2) if len(con) == 1 && con[0] != "no-new-privileges" { if strings.Contains(opt, ":") { con = strings.SplitN(opt, ":", 2) } else { return securityOpts, errors.Errorf("...
[ "func", "parseSecurityOpts", "(", "securityOpts", "[", "]", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "for", "key", ",", "opt", ":=", "range", "securityOpts", "{", "con", ":=", "strings", ".", "SplitN", "(", "opt", ",", "\"", "\...
// takes a local seccomp daemon, reads the file contents for sending to the daemon
[ "takes", "a", "local", "seccomp", "daemon", "reads", "the", "file", "contents", "for", "sending", "to", "the", "daemon" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/container/opts.go#L806-L830
train
docker/cli
cli/command/container/opts.go
parseSystemPaths
func parseSystemPaths(securityOpts []string) (filtered, maskedPaths, readonlyPaths []string) { filtered = securityOpts[:0] for _, opt := range securityOpts { if opt == "systempaths=unconfined" { maskedPaths = []string{} readonlyPaths = []string{} } else { filtered = append(filtered, opt) } } return ...
go
func parseSystemPaths(securityOpts []string) (filtered, maskedPaths, readonlyPaths []string) { filtered = securityOpts[:0] for _, opt := range securityOpts { if opt == "systempaths=unconfined" { maskedPaths = []string{} readonlyPaths = []string{} } else { filtered = append(filtered, opt) } } return ...
[ "func", "parseSystemPaths", "(", "securityOpts", "[", "]", "string", ")", "(", "filtered", ",", "maskedPaths", ",", "readonlyPaths", "[", "]", "string", ")", "{", "filtered", "=", "securityOpts", "[", ":", "0", "]", "\n", "for", "_", ",", "opt", ":=", ...
// parseSystemPaths checks if `systempaths=unconfined` security option is set, // and returns the `MaskedPaths` and `ReadonlyPaths` accordingly. An updated // list of security options is returned with this option removed, because the // `unconfined` option is handled client-side, and should not be sent to the // daemon...
[ "parseSystemPaths", "checks", "if", "systempaths", "=", "unconfined", "security", "option", "is", "set", "and", "returns", "the", "MaskedPaths", "and", "ReadonlyPaths", "accordingly", ".", "An", "updated", "list", "of", "security", "options", "is", "returned", "wi...
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/container/opts.go#L837-L849
train
docker/cli
cli/command/container/opts.go
parseStorageOpts
func parseStorageOpts(storageOpts []string) (map[string]string, error) { m := make(map[string]string) for _, option := range storageOpts { if strings.Contains(option, "=") { opt := strings.SplitN(option, "=", 2) m[opt[0]] = opt[1] } else { return nil, errors.Errorf("invalid storage option") } } retur...
go
func parseStorageOpts(storageOpts []string) (map[string]string, error) { m := make(map[string]string) for _, option := range storageOpts { if strings.Contains(option, "=") { opt := strings.SplitN(option, "=", 2) m[opt[0]] = opt[1] } else { return nil, errors.Errorf("invalid storage option") } } retur...
[ "func", "parseStorageOpts", "(", "storageOpts", "[", "]", "string", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "m", ":=", "make", "(", "map", "[", "string", "]", "string", ")", "\n", "for", "_", ",", "option", ":=", "ran...
// parses storage options per container into a map
[ "parses", "storage", "options", "per", "container", "into", "a", "map" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/container/opts.go#L852-L863
train
docker/cli
cli/command/container/opts.go
parseDevice
func parseDevice(device, serverOS string) (container.DeviceMapping, error) { switch serverOS { case "linux": return parseLinuxDevice(device) case "windows": return parseWindowsDevice(device) } return container.DeviceMapping{}, errors.Errorf("unknown server OS: %s", serverOS) }
go
func parseDevice(device, serverOS string) (container.DeviceMapping, error) { switch serverOS { case "linux": return parseLinuxDevice(device) case "windows": return parseWindowsDevice(device) } return container.DeviceMapping{}, errors.Errorf("unknown server OS: %s", serverOS) }
[ "func", "parseDevice", "(", "device", ",", "serverOS", "string", ")", "(", "container", ".", "DeviceMapping", ",", "error", ")", "{", "switch", "serverOS", "{", "case", "\"", "\"", ":", "return", "parseLinuxDevice", "(", "device", ")", "\n", "case", "\"", ...
// parseDevice parses a device mapping string to a container.DeviceMapping struct
[ "parseDevice", "parses", "a", "device", "mapping", "string", "to", "a", "container", ".", "DeviceMapping", "struct" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/container/opts.go#L866-L874
train
docker/cli
cli/command/container/opts.go
parseLinuxDevice
func parseLinuxDevice(device string) (container.DeviceMapping, error) { src := "" dst := "" permissions := "rwm" arr := strings.Split(device, ":") switch len(arr) { case 3: permissions = arr[2] fallthrough case 2: if validDeviceMode(arr[1]) { permissions = arr[1] } else { dst = arr[1] } fallthr...
go
func parseLinuxDevice(device string) (container.DeviceMapping, error) { src := "" dst := "" permissions := "rwm" arr := strings.Split(device, ":") switch len(arr) { case 3: permissions = arr[2] fallthrough case 2: if validDeviceMode(arr[1]) { permissions = arr[1] } else { dst = arr[1] } fallthr...
[ "func", "parseLinuxDevice", "(", "device", "string", ")", "(", "container", ".", "DeviceMapping", ",", "error", ")", "{", "src", ":=", "\"", "\"", "\n", "dst", ":=", "\"", "\"", "\n", "permissions", ":=", "\"", "\"", "\n", "arr", ":=", "strings", ".", ...
// parseLinuxDevice parses a device mapping string to a container.DeviceMapping struct // knowing that the target is a Linux daemon
[ "parseLinuxDevice", "parses", "a", "device", "mapping", "string", "to", "a", "container", ".", "DeviceMapping", "struct", "knowing", "that", "the", "target", "is", "a", "Linux", "daemon" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/container/opts.go#L878-L910
train
docker/cli
cli/command/container/opts.go
parseWindowsDevice
func parseWindowsDevice(device string) (container.DeviceMapping, error) { return container.DeviceMapping{PathOnHost: device}, nil }
go
func parseWindowsDevice(device string) (container.DeviceMapping, error) { return container.DeviceMapping{PathOnHost: device}, nil }
[ "func", "parseWindowsDevice", "(", "device", "string", ")", "(", "container", ".", "DeviceMapping", ",", "error", ")", "{", "return", "container", ".", "DeviceMapping", "{", "PathOnHost", ":", "device", "}", ",", "nil", "\n", "}" ]
// parseWindowsDevice parses a device mapping string to a container.DeviceMapping struct // knowing that the target is a Windows daemon
[ "parseWindowsDevice", "parses", "a", "device", "mapping", "string", "to", "a", "container", ".", "DeviceMapping", "struct", "knowing", "that", "the", "target", "is", "a", "Windows", "daemon" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/container/opts.go#L914-L916
train
docker/cli
cli/command/container/opts.go
validateDevice
func validateDevice(val string, serverOS string) (string, error) { switch serverOS { case "linux": return validateLinuxPath(val, validDeviceMode) case "windows": // Windows does validation entirely server-side return val, nil } return "", errors.Errorf("unknown server OS: %s", serverOS) }
go
func validateDevice(val string, serverOS string) (string, error) { switch serverOS { case "linux": return validateLinuxPath(val, validDeviceMode) case "windows": // Windows does validation entirely server-side return val, nil } return "", errors.Errorf("unknown server OS: %s", serverOS) }
[ "func", "validateDevice", "(", "val", "string", ",", "serverOS", "string", ")", "(", "string", ",", "error", ")", "{", "switch", "serverOS", "{", "case", "\"", "\"", ":", "return", "validateLinuxPath", "(", "val", ",", "validDeviceMode", ")", "\n", "case",...
// validateDevice validates a path for devices
[ "validateDevice", "validates", "a", "path", "for", "devices" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/container/opts.go#L950-L959
train
docker/cli
cli/command/container/opts.go
validateAttach
func validateAttach(val string) (string, error) { s := strings.ToLower(val) for _, str := range []string{"stdin", "stdout", "stderr"} { if s == str { return s, nil } } return val, errors.Errorf("valid streams are STDIN, STDOUT and STDERR") }
go
func validateAttach(val string) (string, error) { s := strings.ToLower(val) for _, str := range []string{"stdin", "stdout", "stderr"} { if s == str { return s, nil } } return val, errors.Errorf("valid streams are STDIN, STDOUT and STDERR") }
[ "func", "validateAttach", "(", "val", "string", ")", "(", "string", ",", "error", ")", "{", "s", ":=", "strings", ".", "ToLower", "(", "val", ")", "\n", "for", "_", ",", "str", ":=", "range", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ...
// validateAttach validates that the specified string is a valid attach option.
[ "validateAttach", "validates", "that", "the", "specified", "string", "is", "a", "valid", "attach", "option", "." ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/container/opts.go#L1007-L1015
train
docker/cli
cli/command/container/run.go
NewRunCommand
func NewRunCommand(dockerCli command.Cli) *cobra.Command { var opts runOptions var copts *containerOptions cmd := &cobra.Command{ Use: "run [OPTIONS] IMAGE [COMMAND] [ARG...]", Short: "Run a command in a new container", Args: cli.RequiresMinArgs(1), RunE: func(cmd *cobra.Command, args []string) error { ...
go
func NewRunCommand(dockerCli command.Cli) *cobra.Command { var opts runOptions var copts *containerOptions cmd := &cobra.Command{ Use: "run [OPTIONS] IMAGE [COMMAND] [ARG...]", Short: "Run a command in a new container", Args: cli.RequiresMinArgs(1), RunE: func(cmd *cobra.Command, args []string) error { ...
[ "func", "NewRunCommand", "(", "dockerCli", "command", ".", "Cli", ")", "*", "cobra", ".", "Command", "{", "var", "opts", "runOptions", "\n", "var", "copts", "*", "containerOptions", "\n\n", "cmd", ":=", "&", "cobra", ".", "Command", "{", "Use", ":", "\""...
// NewRunCommand create a new `docker run` command
[ "NewRunCommand", "create", "a", "new", "docker", "run", "command" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/container/run.go#L34-L68
train
docker/cli
cli/command/container/run.go
reportError
func reportError(stderr io.Writer, name string, str string, withHelp bool) { str = strings.TrimSuffix(str, ".") + "." if withHelp { str += "\nSee '" + os.Args[0] + " " + name + " --help'." } fmt.Fprintf(stderr, "%s: %s\n", os.Args[0], str) }
go
func reportError(stderr io.Writer, name string, str string, withHelp bool) { str = strings.TrimSuffix(str, ".") + "." if withHelp { str += "\nSee '" + os.Args[0] + " " + name + " --help'." } fmt.Fprintf(stderr, "%s: %s\n", os.Args[0], str) }
[ "func", "reportError", "(", "stderr", "io", ".", "Writer", ",", "name", "string", ",", "str", "string", ",", "withHelp", "bool", ")", "{", "str", "=", "strings", ".", "TrimSuffix", "(", "str", ",", "\"", "\"", ")", "+", "\"", "\"", "\n", "if", "wit...
// reportError is a utility method that prints a user-friendly message // containing the error that occurred during parsing and a suggestion to get help
[ "reportError", "is", "a", "utility", "method", "that", "prints", "a", "user", "-", "friendly", "message", "containing", "the", "error", "that", "occurred", "during", "parsing", "and", "a", "suggestion", "to", "get", "help" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/container/run.go#L289-L295
train
docker/cli
cli/command/image/build.go
validateTag
func validateTag(rawRepo string) (string, error) { _, err := reference.ParseNormalizedNamed(rawRepo) if err != nil { return "", err } return rawRepo, nil }
go
func validateTag(rawRepo string) (string, error) { _, err := reference.ParseNormalizedNamed(rawRepo) if err != nil { return "", err } return rawRepo, nil }
[ "func", "validateTag", "(", "rawRepo", "string", ")", "(", "string", ",", "error", ")", "{", "_", ",", "err", ":=", "reference", ".", "ParseNormalizedNamed", "(", "rawRepo", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", ...
// validateTag checks if the given image name can be resolved.
[ "validateTag", "checks", "if", "the", "given", "image", "name", "can", "be", "resolved", "." ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/image/build.go#L509-L516
train
docker/cli
cli/command/image/build.go
replaceDockerfileForContentTrust
func replaceDockerfileForContentTrust(ctx context.Context, inputTarStream io.ReadCloser, dockerfileName string, translator translatorFunc, resolvedTags *[]*resolvedTag) io.ReadCloser { pipeReader, pipeWriter := io.Pipe() go func() { tarReader := tar.NewReader(inputTarStream) tarWriter := tar.NewWriter(pipeWriter)...
go
func replaceDockerfileForContentTrust(ctx context.Context, inputTarStream io.ReadCloser, dockerfileName string, translator translatorFunc, resolvedTags *[]*resolvedTag) io.ReadCloser { pipeReader, pipeWriter := io.Pipe() go func() { tarReader := tar.NewReader(inputTarStream) tarWriter := tar.NewWriter(pipeWriter)...
[ "func", "replaceDockerfileForContentTrust", "(", "ctx", "context", ".", "Context", ",", "inputTarStream", "io", ".", "ReadCloser", ",", "dockerfileName", "string", ",", "translator", "translatorFunc", ",", "resolvedTags", "*", "[", "]", "*", "resolvedTag", ")", "i...
// replaceDockerfileForContentTrust wraps the given input tar archive stream and // uses the translator to replace the Dockerfile which uses a trusted reference. // Returns a new tar archive stream with the replaced Dockerfile.
[ "replaceDockerfileForContentTrust", "wraps", "the", "given", "input", "tar", "archive", "stream", "and", "uses", "the", "translator", "to", "replace", "the", "Dockerfile", "which", "uses", "a", "trusted", "reference", ".", "Returns", "a", "new", "tar", "archive", ...
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/image/build.go#L575-L624
train
docker/cli
cli/command/stack/formatter/formatter.go
StackWrite
func StackWrite(ctx formatter.Context, stacks []*Stack) error { render := func(format func(subContext formatter.SubContext) error) error { for _, stack := range stacks { if err := format(&stackContext{s: stack}); err != nil { return err } } return nil } return ctx.Write(newStackContext(), render) }
go
func StackWrite(ctx formatter.Context, stacks []*Stack) error { render := func(format func(subContext formatter.SubContext) error) error { for _, stack := range stacks { if err := format(&stackContext{s: stack}); err != nil { return err } } return nil } return ctx.Write(newStackContext(), render) }
[ "func", "StackWrite", "(", "ctx", "formatter", ".", "Context", ",", "stacks", "[", "]", "*", "Stack", ")", "error", "{", "render", ":=", "func", "(", "format", "func", "(", "subContext", "formatter", ".", "SubContext", ")", "error", ")", "error", "{", ...
// StackWrite writes formatted stacks using the Context
[ "StackWrite", "writes", "formatted", "stacks", "using", "the", "Context" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/stack/formatter/formatter.go#L42-L52
train
docker/cli
docs/yaml/yaml.go
GenYamlTreeCustom
func GenYamlTreeCustom(cmd *cobra.Command, dir string, filePrepender func(string) string) error { for _, c := range cmd.Commands() { if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() { continue } if err := GenYamlTreeCustom(c, dir, filePrepender); err != nil { return err } } basename := s...
go
func GenYamlTreeCustom(cmd *cobra.Command, dir string, filePrepender func(string) string) error { for _, c := range cmd.Commands() { if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() { continue } if err := GenYamlTreeCustom(c, dir, filePrepender); err != nil { return err } } basename := s...
[ "func", "GenYamlTreeCustom", "(", "cmd", "*", "cobra", ".", "Command", ",", "dir", "string", ",", "filePrepender", "func", "(", "string", ")", "string", ")", "error", "{", "for", "_", ",", "c", ":=", "range", "cmd", ".", "Commands", "(", ")", "{", "i...
// GenYamlTreeCustom creates yaml structured ref files
[ "GenYamlTreeCustom", "creates", "yaml", "structured", "ref", "files" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/docs/yaml/yaml.go#L62-L84
train
docker/cli
cli/compose/types/types.go
ConvertDurationPtr
func ConvertDurationPtr(d *Duration) *time.Duration { if d == nil { return nil } res := time.Duration(*d) return &res }
go
func ConvertDurationPtr(d *Duration) *time.Duration { if d == nil { return nil } res := time.Duration(*d) return &res }
[ "func", "ConvertDurationPtr", "(", "d", "*", "Duration", ")", "*", "time", ".", "Duration", "{", "if", "d", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "res", ":=", "time", ".", "Duration", "(", "*", "d", ")", "\n", "return", "&", "res", ...
// ConvertDurationPtr converts a typedefined Duration pointer to a time.Duration pointer with the same value.
[ "ConvertDurationPtr", "converts", "a", "typedefined", "Duration", "pointer", "to", "a", "time", ".", "Duration", "pointer", "with", "the", "same", "value", "." ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/compose/types/types.go#L73-L79
train
docker/cli
cli/compose/types/types.go
LookupEnv
func (cd ConfigDetails) LookupEnv(key string) (string, bool) { v, ok := cd.Environment[key] return v, ok }
go
func (cd ConfigDetails) LookupEnv(key string) (string, bool) { v, ok := cd.Environment[key] return v, ok }
[ "func", "(", "cd", "ConfigDetails", ")", "LookupEnv", "(", "key", "string", ")", "(", "string", ",", "bool", ")", "{", "v", ",", "ok", ":=", "cd", ".", "Environment", "[", "key", "]", "\n", "return", "v", ",", "ok", "\n", "}" ]
// LookupEnv provides a lookup function for environment variables
[ "LookupEnv", "provides", "a", "lookup", "function", "for", "environment", "variables" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/compose/types/types.go#L92-L95
train
docker/cli
cli/compose/types/types.go
MarshalJSON
func (c Config) MarshalJSON() ([]byte, error) { m := map[string]interface{}{ "version": c.Version, "services": c.Services, } if len(c.Networks) > 0 { m["networks"] = c.Networks } if len(c.Volumes) > 0 { m["volumes"] = c.Volumes } if len(c.Secrets) > 0 { m["secrets"] = c.Secrets } if len(c.Configs) ...
go
func (c Config) MarshalJSON() ([]byte, error) { m := map[string]interface{}{ "version": c.Version, "services": c.Services, } if len(c.Networks) > 0 { m["networks"] = c.Networks } if len(c.Volumes) > 0 { m["volumes"] = c.Volumes } if len(c.Secrets) > 0 { m["secrets"] = c.Secrets } if len(c.Configs) ...
[ "func", "(", "c", "Config", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "m", ":=", "map", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":", "c", ".", "Version", ",", "\"", "\"", ":", "c", ".", ...
// MarshalJSON makes Config implement json.Marshaler
[ "MarshalJSON", "makes", "Config", "implement", "json", ".", "Marshaler" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/compose/types/types.go#L110-L132
train
docker/cli
cli/compose/types/types.go
MarshalYAML
func (s Services) MarshalYAML() (interface{}, error) { services := map[string]ServiceConfig{} for _, service := range s { services[service.Name] = service } return services, nil }
go
func (s Services) MarshalYAML() (interface{}, error) { services := map[string]ServiceConfig{} for _, service := range s { services[service.Name] = service } return services, nil }
[ "func", "(", "s", "Services", ")", "MarshalYAML", "(", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "services", ":=", "map", "[", "string", "]", "ServiceConfig", "{", "}", "\n", "for", "_", ",", "service", ":=", "range", "s", "{", "serv...
// MarshalYAML makes Services implement yaml.Marshaller
[ "MarshalYAML", "makes", "Services", "implement", "yaml", ".", "Marshaller" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/compose/types/types.go#L138-L144
train
docker/cli
cli/compose/types/types.go
MarshalJSON
func (s Services) MarshalJSON() ([]byte, error) { data, err := s.MarshalYAML() if err != nil { return nil, err } return json.MarshalIndent(data, "", " ") }
go
func (s Services) MarshalJSON() ([]byte, error) { data, err := s.MarshalYAML() if err != nil { return nil, err } return json.MarshalIndent(data, "", " ") }
[ "func", "(", "s", "Services", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "data", ",", "err", ":=", "s", ".", "MarshalYAML", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}",...
// MarshalJSON makes Services implement json.Marshaler
[ "MarshalJSON", "makes", "Services", "implement", "json", ".", "Marshaler" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/compose/types/types.go#L147-L153
train
docker/cli
cli/compose/types/types.go
MarshalJSON
func (u UnitBytes) MarshalJSON() ([]byte, error) { return []byte(fmt.Sprintf(`"%d"`, u)), nil }
go
func (u UnitBytes) MarshalJSON() ([]byte, error) { return []byte(fmt.Sprintf(`"%d"`, u)), nil }
[ "func", "(", "u", "UnitBytes", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "[", "]", "byte", "(", "fmt", ".", "Sprintf", "(", "`\"%d\"`", ",", "u", ")", ")", ",", "nil", "\n", "}" ]
// MarshalJSON makes UnitBytes implement json.Marshaler
[ "MarshalJSON", "makes", "UnitBytes", "implement", "json", ".", "Marshaler" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/compose/types/types.go#L338-L340
train
docker/cli
cli/compose/types/types.go
MarshalYAML
func (u *UlimitsConfig) MarshalYAML() (interface{}, error) { if u.Single != 0 { return u.Single, nil } return u, nil }
go
func (u *UlimitsConfig) MarshalYAML() (interface{}, error) { if u.Single != 0 { return u.Single, nil } return u, nil }
[ "func", "(", "u", "*", "UlimitsConfig", ")", "MarshalYAML", "(", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "if", "u", ".", "Single", "!=", "0", "{", "return", "u", ".", "Single", ",", "nil", "\n", "}", "\n", "return", "u", ",", "...
// MarshalYAML makes UlimitsConfig implement yaml.Marshaller
[ "MarshalYAML", "makes", "UlimitsConfig", "implement", "yaml", ".", "Marshaller" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/compose/types/types.go#L427-L432
train
docker/cli
cli/compose/types/types.go
MarshalJSON
func (u *UlimitsConfig) MarshalJSON() ([]byte, error) { if u.Single != 0 { return json.Marshal(u.Single) } // Pass as a value to avoid re-entering this method and use the default implementation return json.Marshal(*u) }
go
func (u *UlimitsConfig) MarshalJSON() ([]byte, error) { if u.Single != 0 { return json.Marshal(u.Single) } // Pass as a value to avoid re-entering this method and use the default implementation return json.Marshal(*u) }
[ "func", "(", "u", "*", "UlimitsConfig", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "u", ".", "Single", "!=", "0", "{", "return", "json", ".", "Marshal", "(", "u", ".", "Single", ")", "\n", "}", "\n", "// ...
// MarshalJSON makes UlimitsConfig implement json.Marshaller
[ "MarshalJSON", "makes", "UlimitsConfig", "implement", "json", ".", "Marshaller" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/compose/types/types.go#L435-L441
train
docker/cli
cli/compose/types/types.go
MarshalYAML
func (e External) MarshalYAML() (interface{}, error) { if e.Name == "" { return e.External, nil } return External{Name: e.Name}, nil }
go
func (e External) MarshalYAML() (interface{}, error) { if e.Name == "" { return e.External, nil } return External{Name: e.Name}, nil }
[ "func", "(", "e", "External", ")", "MarshalYAML", "(", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "if", "e", ".", "Name", "==", "\"", "\"", "{", "return", "e", ".", "External", ",", "nil", "\n", "}", "\n", "return", "External", "{",...
// MarshalYAML makes External implement yaml.Marshaller
[ "MarshalYAML", "makes", "External", "implement", "yaml", ".", "Marshaller" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/compose/types/types.go#L486-L491
train
docker/cli
cli/compose/types/types.go
MarshalJSON
func (e External) MarshalJSON() ([]byte, error) { if e.Name == "" { return []byte(fmt.Sprintf("%v", e.External)), nil } return []byte(fmt.Sprintf(`{"name": %q}`, e.Name)), nil }
go
func (e External) MarshalJSON() ([]byte, error) { if e.Name == "" { return []byte(fmt.Sprintf("%v", e.External)), nil } return []byte(fmt.Sprintf(`{"name": %q}`, e.Name)), nil }
[ "func", "(", "e", "External", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "e", ".", "Name", "==", "\"", "\"", "{", "return", "[", "]", "byte", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "e", ".", ...
// MarshalJSON makes External implement json.Marshaller
[ "MarshalJSON", "makes", "External", "implement", "json", ".", "Marshaller" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/compose/types/types.go#L494-L499
train
docker/cli
cli/command/image/trust.go
TrustedPush
func TrustedPush(ctx context.Context, cli command.Cli, repoInfo *registry.RepositoryInfo, ref reference.Named, authConfig types.AuthConfig, requestPrivilege types.RequestPrivilegeFunc) error { responseBody, err := imagePushPrivileged(ctx, cli, authConfig, ref, requestPrivilege) if err != nil { return err } defer...
go
func TrustedPush(ctx context.Context, cli command.Cli, repoInfo *registry.RepositoryInfo, ref reference.Named, authConfig types.AuthConfig, requestPrivilege types.RequestPrivilegeFunc) error { responseBody, err := imagePushPrivileged(ctx, cli, authConfig, ref, requestPrivilege) if err != nil { return err } defer...
[ "func", "TrustedPush", "(", "ctx", "context", ".", "Context", ",", "cli", "command", ".", "Cli", ",", "repoInfo", "*", "registry", ".", "RepositoryInfo", ",", "ref", "reference", ".", "Named", ",", "authConfig", "types", ".", "AuthConfig", ",", "requestPrivi...
// TrustedPush handles content trust pushing of an image
[ "TrustedPush", "handles", "content", "trust", "pushing", "of", "an", "image" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/image/trust.go#L34-L43
train
docker/cli
cli/command/image/trust.go
imagePushPrivileged
func imagePushPrivileged(ctx context.Context, cli command.Cli, authConfig types.AuthConfig, ref reference.Reference, requestPrivilege types.RequestPrivilegeFunc) (io.ReadCloser, error) { encodedAuth, err := command.EncodeAuthToBase64(authConfig) if err != nil { return nil, err } options := types.ImagePushOptions{...
go
func imagePushPrivileged(ctx context.Context, cli command.Cli, authConfig types.AuthConfig, ref reference.Reference, requestPrivilege types.RequestPrivilegeFunc) (io.ReadCloser, error) { encodedAuth, err := command.EncodeAuthToBase64(authConfig) if err != nil { return nil, err } options := types.ImagePushOptions{...
[ "func", "imagePushPrivileged", "(", "ctx", "context", ".", "Context", ",", "cli", "command", ".", "Cli", ",", "authConfig", "types", ".", "AuthConfig", ",", "ref", "reference", ".", "Reference", ",", "requestPrivilege", "types", ".", "RequestPrivilegeFunc", ")",...
// imagePushPrivileged push the image
[ "imagePushPrivileged", "push", "the", "image" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/image/trust.go#L171-L182
train
docker/cli
cli/command/image/trust.go
trustedPull
func trustedPull(ctx context.Context, cli command.Cli, imgRefAndAuth trust.ImageRefAndAuth, opts PullOptions) error { refs, err := getTrustedPullTargets(cli, imgRefAndAuth) if err != nil { return err } ref := imgRefAndAuth.Reference() for i, r := range refs { displayTag := r.name if displayTag != "" { di...
go
func trustedPull(ctx context.Context, cli command.Cli, imgRefAndAuth trust.ImageRefAndAuth, opts PullOptions) error { refs, err := getTrustedPullTargets(cli, imgRefAndAuth) if err != nil { return err } ref := imgRefAndAuth.Reference() for i, r := range refs { displayTag := r.name if displayTag != "" { di...
[ "func", "trustedPull", "(", "ctx", "context", ".", "Context", ",", "cli", "command", ".", "Cli", ",", "imgRefAndAuth", "trust", ".", "ImageRefAndAuth", ",", "opts", "PullOptions", ")", "error", "{", "refs", ",", "err", ":=", "getTrustedPullTargets", "(", "cl...
// trustedPull handles content trust pulling of an image
[ "trustedPull", "handles", "content", "trust", "pulling", "of", "an", "image" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/image/trust.go#L185-L226
train
docker/cli
cli/command/image/trust.go
imagePullPrivileged
func imagePullPrivileged(ctx context.Context, cli command.Cli, imgRefAndAuth trust.ImageRefAndAuth, opts PullOptions) error { ref := reference.FamiliarString(imgRefAndAuth.Reference()) encodedAuth, err := command.EncodeAuthToBase64(*imgRefAndAuth.AuthConfig()) if err != nil { return err } requestPrivilege := co...
go
func imagePullPrivileged(ctx context.Context, cli command.Cli, imgRefAndAuth trust.ImageRefAndAuth, opts PullOptions) error { ref := reference.FamiliarString(imgRefAndAuth.Reference()) encodedAuth, err := command.EncodeAuthToBase64(*imgRefAndAuth.AuthConfig()) if err != nil { return err } requestPrivilege := co...
[ "func", "imagePullPrivileged", "(", "ctx", "context", ".", "Context", ",", "cli", "command", ".", "Cli", ",", "imgRefAndAuth", "trust", ".", "ImageRefAndAuth", ",", "opts", "PullOptions", ")", "error", "{", "ref", ":=", "reference", ".", "FamiliarString", "(",...
// imagePullPrivileged pulls the image and displays it to the output
[ "imagePullPrivileged", "pulls", "the", "image", "and", "displays", "it", "to", "the", "output" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/image/trust.go#L278-L303
train
docker/cli
cli/command/image/trust.go
TrustedReference
func TrustedReference(ctx context.Context, cli command.Cli, ref reference.NamedTagged, rs registry.Service) (reference.Canonical, error) { imgRefAndAuth, err := trust.GetImageReferencesAndAuth(ctx, rs, AuthResolver(cli), ref.String()) if err != nil { return nil, err } notaryRepo, err := cli.NotaryClient(imgRefAn...
go
func TrustedReference(ctx context.Context, cli command.Cli, ref reference.NamedTagged, rs registry.Service) (reference.Canonical, error) { imgRefAndAuth, err := trust.GetImageReferencesAndAuth(ctx, rs, AuthResolver(cli), ref.String()) if err != nil { return nil, err } notaryRepo, err := cli.NotaryClient(imgRefAn...
[ "func", "TrustedReference", "(", "ctx", "context", ".", "Context", ",", "cli", "command", ".", "Cli", ",", "ref", "reference", ".", "NamedTagged", ",", "rs", "registry", ".", "Service", ")", "(", "reference", ".", "Canonical", ",", "error", ")", "{", "im...
// TrustedReference returns the canonical trusted reference for an image reference
[ "TrustedReference", "returns", "the", "canonical", "trusted", "reference", "for", "an", "image", "reference" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/image/trust.go#L306-L332
train
docker/cli
cli/command/image/trust.go
AuthResolver
func AuthResolver(cli command.Cli) func(ctx context.Context, index *registrytypes.IndexInfo) types.AuthConfig { return func(ctx context.Context, index *registrytypes.IndexInfo) types.AuthConfig { return command.ResolveAuthConfig(ctx, cli, index) } }
go
func AuthResolver(cli command.Cli) func(ctx context.Context, index *registrytypes.IndexInfo) types.AuthConfig { return func(ctx context.Context, index *registrytypes.IndexInfo) types.AuthConfig { return command.ResolveAuthConfig(ctx, cli, index) } }
[ "func", "AuthResolver", "(", "cli", "command", ".", "Cli", ")", "func", "(", "ctx", "context", ".", "Context", ",", "index", "*", "registrytypes", ".", "IndexInfo", ")", "types", ".", "AuthConfig", "{", "return", "func", "(", "ctx", "context", ".", "Cont...
// AuthResolver returns an auth resolver function from a command.Cli
[ "AuthResolver", "returns", "an", "auth", "resolver", "function", "from", "a", "command", ".", "Cli" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/image/trust.go#L359-L363
train
docker/cli
cli/command/service/formatter.go
NewFormat
func NewFormat(source string) formatter.Format { switch source { case formatter.PrettyFormatKey: return serviceInspectPrettyTemplate default: return formatter.Format(strings.TrimPrefix(source, formatter.RawFormatKey)) } }
go
func NewFormat(source string) formatter.Format { switch source { case formatter.PrettyFormatKey: return serviceInspectPrettyTemplate default: return formatter.Format(strings.TrimPrefix(source, formatter.RawFormatKey)) } }
[ "func", "NewFormat", "(", "source", "string", ")", "formatter", ".", "Format", "{", "switch", "source", "{", "case", "formatter", ".", "PrettyFormatKey", ":", "return", "serviceInspectPrettyTemplate", "\n", "default", ":", "return", "formatter", ".", "Format", "...
// NewFormat returns a Format for rendering using a Context
[ "NewFormat", "returns", "a", "Format", "for", "rendering", "using", "a", "Context" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/service/formatter.go#L170-L177
train
docker/cli
cli/command/service/formatter.go
InspectFormatWrite
func InspectFormatWrite(ctx formatter.Context, refs []string, getRef, getNetwork inspect.GetRefFunc) error { if ctx.Format != serviceInspectPrettyTemplate { return inspect.Inspect(ctx.Output, refs, string(ctx.Format), getRef) } render := func(format func(subContext formatter.SubContext) error) error { for _, ref...
go
func InspectFormatWrite(ctx formatter.Context, refs []string, getRef, getNetwork inspect.GetRefFunc) error { if ctx.Format != serviceInspectPrettyTemplate { return inspect.Inspect(ctx.Output, refs, string(ctx.Format), getRef) } render := func(format func(subContext formatter.SubContext) error) error { for _, ref...
[ "func", "InspectFormatWrite", "(", "ctx", "formatter", ".", "Context", ",", "refs", "[", "]", "string", ",", "getRef", ",", "getNetwork", "inspect", ".", "GetRefFunc", ")", "error", "{", "if", "ctx", ".", "Format", "!=", "serviceInspectPrettyTemplate", "{", ...
// InspectFormatWrite renders the context for a list of services
[ "InspectFormatWrite", "renders", "the", "context", "for", "a", "list", "of", "services" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/service/formatter.go#L192-L213
train
docker/cli
cli/command/service/formatter.go
NewListFormat
func NewListFormat(source string, quiet bool) formatter.Format { switch source { case formatter.TableFormatKey: if quiet { return formatter.DefaultQuietFormat } return defaultServiceTableFormat case formatter.RawFormatKey: if quiet { return `id: {{.ID}}` } return `id: {{.ID}}\nname: {{.Name}}\nmode...
go
func NewListFormat(source string, quiet bool) formatter.Format { switch source { case formatter.TableFormatKey: if quiet { return formatter.DefaultQuietFormat } return defaultServiceTableFormat case formatter.RawFormatKey: if quiet { return `id: {{.ID}}` } return `id: {{.ID}}\nname: {{.Name}}\nmode...
[ "func", "NewListFormat", "(", "source", "string", ",", "quiet", "bool", ")", "formatter", ".", "Format", "{", "switch", "source", "{", "case", "formatter", ".", "TableFormatKey", ":", "if", "quiet", "{", "return", "formatter", ".", "DefaultQuietFormat", "\n", ...
// NewListFormat returns a Format for rendering using a service Context
[ "NewListFormat", "returns", "a", "Format", "for", "rendering", "using", "a", "service", "Context" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/service/formatter.go#L507-L521
train
docker/cli
cli/command/service/formatter.go
ListFormatWrite
func ListFormatWrite(ctx formatter.Context, services []swarm.Service, info map[string]ListInfo) error { render := func(format func(subContext formatter.SubContext) error) error { for _, service := range services { serviceCtx := &serviceContext{service: service, mode: info[service.ID].Mode, replicas: info[service....
go
func ListFormatWrite(ctx formatter.Context, services []swarm.Service, info map[string]ListInfo) error { render := func(format func(subContext formatter.SubContext) error) error { for _, service := range services { serviceCtx := &serviceContext{service: service, mode: info[service.ID].Mode, replicas: info[service....
[ "func", "ListFormatWrite", "(", "ctx", "formatter", ".", "Context", ",", "services", "[", "]", "swarm", ".", "Service", ",", "info", "map", "[", "string", "]", "ListInfo", ")", "error", "{", "render", ":=", "func", "(", "format", "func", "(", "subContext...
// ListFormatWrite writes the context
[ "ListFormatWrite", "writes", "the", "context" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/service/formatter.go#L530-L550
train
docker/cli
cli/command/container/restart.go
NewRestartCommand
func NewRestartCommand(dockerCli command.Cli) *cobra.Command { var opts restartOptions cmd := &cobra.Command{ Use: "restart [OPTIONS] CONTAINER [CONTAINER...]", Short: "Restart one or more containers", Args: cli.RequiresMinArgs(1), RunE: func(cmd *cobra.Command, args []string) error { opts.containers =...
go
func NewRestartCommand(dockerCli command.Cli) *cobra.Command { var opts restartOptions cmd := &cobra.Command{ Use: "restart [OPTIONS] CONTAINER [CONTAINER...]", Short: "Restart one or more containers", Args: cli.RequiresMinArgs(1), RunE: func(cmd *cobra.Command, args []string) error { opts.containers =...
[ "func", "NewRestartCommand", "(", "dockerCli", "command", ".", "Cli", ")", "*", "cobra", ".", "Command", "{", "var", "opts", "restartOptions", "\n\n", "cmd", ":=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"", "\"", ",", "Short", ":", "\"", "\""...
// NewRestartCommand creates a new cobra.Command for `docker restart`
[ "NewRestartCommand", "creates", "a", "new", "cobra", ".", "Command", "for", "docker", "restart" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/container/restart.go#L23-L40
train
docker/cli
cli-plugins/manager/suffix_windows.go
trimExeSuffix
func trimExeSuffix(s string) (string, error) { ext := filepath.Ext(s) if ext == "" { return "", errors.Errorf("path %q lacks required file extension", s) } exe := ".exe" if !strings.EqualFold(ext, exe) { return "", errors.Errorf("path %q lacks required %q suffix", s, exe) } return strings.TrimSuffix(s, ext)...
go
func trimExeSuffix(s string) (string, error) { ext := filepath.Ext(s) if ext == "" { return "", errors.Errorf("path %q lacks required file extension", s) } exe := ".exe" if !strings.EqualFold(ext, exe) { return "", errors.Errorf("path %q lacks required %q suffix", s, exe) } return strings.TrimSuffix(s, ext)...
[ "func", "trimExeSuffix", "(", "s", "string", ")", "(", "string", ",", "error", ")", "{", "ext", ":=", "filepath", ".", "Ext", "(", "s", ")", "\n", "if", "ext", "==", "\"", "\"", "{", "return", "\"", "\"", ",", "errors", ".", "Errorf", "(", "\"", ...
// This is made slightly more complex due to needing to be case insensitive.
[ "This", "is", "made", "slightly", "more", "complex", "due", "to", "needing", "to", "be", "case", "insensitive", "." ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli-plugins/manager/suffix_windows.go#L11-L22
train
docker/cli
cli/command/trust/key_generate.go
validateKeyArgs
func validateKeyArgs(keyName string, targetDir string) error { if !validKeyName(keyName) { return fmt.Errorf("key name \"%s\" must start with lowercase alphanumeric characters and can include \"-\" or \"_\" after the first character", keyName) } pubKeyFileName := keyName + ".pub" if _, err := os.Stat(targetDir);...
go
func validateKeyArgs(keyName string, targetDir string) error { if !validKeyName(keyName) { return fmt.Errorf("key name \"%s\" must start with lowercase alphanumeric characters and can include \"-\" or \"_\" after the first character", keyName) } pubKeyFileName := keyName + ".pub" if _, err := os.Stat(targetDir);...
[ "func", "validateKeyArgs", "(", "keyName", "string", ",", "targetDir", "string", ")", "error", "{", "if", "!", "validKeyName", "(", "keyName", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\\\"", "\\\"", "\\\"", "\\\"", "\"", ",",...
// validate that all of the key names are unique and are alphanumeric + _ + - // and that we do not already have public key files in the target dir on disk
[ "validate", "that", "all", "of", "the", "key", "names", "are", "unique", "and", "are", "alphanumeric", "+", "_", "+", "-", "and", "that", "we", "do", "not", "already", "have", "public", "key", "files", "in", "the", "target", "dir", "on", "disk" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/trust/key_generate.go#L49-L63
train
docker/cli
internal/pkg/containerized/hostpaths.go
WithAllCapabilities
func WithAllCapabilities(_ context.Context, _ oci.Client, c *containers.Container, s *specs.Spec) error { caps := []string{ "CAP_CHOWN", "CAP_DAC_OVERRIDE", "CAP_DAC_READ_SEARCH", "CAP_FOWNER", "CAP_FSETID", "CAP_KILL", "CAP_SETGID", "CAP_SETUID", "CAP_SETPCAP", "CAP_LINUX_IMMUTABLE", "CAP_NET_BI...
go
func WithAllCapabilities(_ context.Context, _ oci.Client, c *containers.Container, s *specs.Spec) error { caps := []string{ "CAP_CHOWN", "CAP_DAC_OVERRIDE", "CAP_DAC_READ_SEARCH", "CAP_FOWNER", "CAP_FSETID", "CAP_KILL", "CAP_SETGID", "CAP_SETUID", "CAP_SETPCAP", "CAP_LINUX_IMMUTABLE", "CAP_NET_BI...
[ "func", "WithAllCapabilities", "(", "_", "context", ".", "Context", ",", "_", "oci", ".", "Client", ",", "c", "*", "containers", ".", "Container", ",", "s", "*", "specs", ".", "Spec", ")", "error", "{", "caps", ":=", "[", "]", "string", "{", "\"", ...
// WithAllCapabilities enables all capabilities required to run privileged containers
[ "WithAllCapabilities", "enables", "all", "capabilities", "required", "to", "run", "privileged", "containers" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/internal/pkg/containerized/hostpaths.go#L12-L61
train
docker/cli
cli/command/stack/loader/loader.go
LoadComposefile
func LoadComposefile(dockerCli command.Cli, opts options.Deploy) (*composetypes.Config, error) { configDetails, err := getConfigDetails(opts.Composefiles, dockerCli.In()) if err != nil { return nil, err } dicts := getDictsFrom(configDetails.ConfigFiles) config, err := loader.Load(configDetails) if err != nil {...
go
func LoadComposefile(dockerCli command.Cli, opts options.Deploy) (*composetypes.Config, error) { configDetails, err := getConfigDetails(opts.Composefiles, dockerCli.In()) if err != nil { return nil, err } dicts := getDictsFrom(configDetails.ConfigFiles) config, err := loader.Load(configDetails) if err != nil {...
[ "func", "LoadComposefile", "(", "dockerCli", "command", ".", "Cli", ",", "opts", "options", ".", "Deploy", ")", "(", "*", "composetypes", ".", "Config", ",", "error", ")", "{", "configDetails", ",", "err", ":=", "getConfigDetails", "(", "opts", ".", "Compo...
// LoadComposefile parse the composefile specified in the cli and returns its Config and version.
[ "LoadComposefile", "parse", "the", "composefile", "specified", "in", "the", "cli", "and", "returns", "its", "Config", "and", "version", "." ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/stack/loader/loader.go#L21-L50
train
docker/cli
cli/command/system/events.go
NewEventsCommand
func NewEventsCommand(dockerCli command.Cli) *cobra.Command { options := eventsOptions{filter: opts.NewFilterOpt()} cmd := &cobra.Command{ Use: "events [OPTIONS]", Short: "Get real time events from the server", Args: cli.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { return runEvents(doc...
go
func NewEventsCommand(dockerCli command.Cli) *cobra.Command { options := eventsOptions{filter: opts.NewFilterOpt()} cmd := &cobra.Command{ Use: "events [OPTIONS]", Short: "Get real time events from the server", Args: cli.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { return runEvents(doc...
[ "func", "NewEventsCommand", "(", "dockerCli", "command", ".", "Cli", ")", "*", "cobra", ".", "Command", "{", "options", ":=", "eventsOptions", "{", "filter", ":", "opts", ".", "NewFilterOpt", "(", ")", "}", "\n\n", "cmd", ":=", "&", "cobra", ".", "Comman...
// NewEventsCommand creates a new cobra.Command for `docker events`
[ "NewEventsCommand", "creates", "a", "new", "cobra", ".", "Command", "for", "docker", "events" ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/system/events.go#L30-L49
train
docker/cli
cli/command/system/events.go
prettyPrintEvent
func prettyPrintEvent(out io.Writer, event eventtypes.Message) error { if event.TimeNano != 0 { fmt.Fprintf(out, "%s ", time.Unix(0, event.TimeNano).Format(rfc3339NanoFixed)) } else if event.Time != 0 { fmt.Fprintf(out, "%s ", time.Unix(event.Time, 0).Format(rfc3339NanoFixed)) } fmt.Fprintf(out, "%s %s %s", ev...
go
func prettyPrintEvent(out io.Writer, event eventtypes.Message) error { if event.TimeNano != 0 { fmt.Fprintf(out, "%s ", time.Unix(0, event.TimeNano).Format(rfc3339NanoFixed)) } else if event.Time != 0 { fmt.Fprintf(out, "%s ", time.Unix(event.Time, 0).Format(rfc3339NanoFixed)) } fmt.Fprintf(out, "%s %s %s", ev...
[ "func", "prettyPrintEvent", "(", "out", "io", ".", "Writer", ",", "event", "eventtypes", ".", "Message", ")", "error", "{", "if", "event", ".", "TimeNano", "!=", "0", "{", "fmt", ".", "Fprintf", "(", "out", ",", "\"", "\"", ",", "time", ".", "Unix", ...
// prettyPrintEvent prints all types of event information. // Each output includes the event type, actor id, name and action. // Actor attributes are printed at the end if the actor has any.
[ "prettyPrintEvent", "prints", "all", "types", "of", "event", "information", ".", "Each", "output", "includes", "the", "event", "type", "actor", "id", "name", "and", "action", ".", "Actor", "attributes", "are", "printed", "at", "the", "end", "if", "the", "act...
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/system/events.go#L113-L137
train
docker/cli
opts/duration.go
Set
func (d *PositiveDurationOpt) Set(s string) error { err := d.DurationOpt.Set(s) if err != nil { return err } if *d.DurationOpt.value < 0 { return errors.Errorf("duration cannot be negative") } return nil }
go
func (d *PositiveDurationOpt) Set(s string) error { err := d.DurationOpt.Set(s) if err != nil { return err } if *d.DurationOpt.value < 0 { return errors.Errorf("duration cannot be negative") } return nil }
[ "func", "(", "d", "*", "PositiveDurationOpt", ")", "Set", "(", "s", "string", ")", "error", "{", "err", ":=", "d", ".", "DurationOpt", ".", "Set", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "*", ...
// Set a new value on the option. Setting a negative duration value will cause // an error to be returned.
[ "Set", "a", "new", "value", "on", "the", "option", ".", "Setting", "a", "negative", "duration", "value", "will", "cause", "an", "error", "to", "be", "returned", "." ]
3273c2e23546dddd0ff8bb499f4aba02fe60bf30
https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/opts/duration.go#L17-L26
train