id int32 0 167k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
159,900 | docker/cli | cli/command/builder/cmd.go | NewBuilderCommand | func NewBuilderCommand(dockerCli command.Cli) *cobra.Command {
cmd := &cobra.Command{
Use: "builder",
Short: "Manage builds",
Args: cli.NoArgs,
RunE: command.ShowHelp(dockerCli.Err()),
Annotations: map[string]string{"version": "1.31"},
}
cmd.AddCommand(
NewPruneCommand(dockerC... | go | func NewBuilderCommand(dockerCli command.Cli) *cobra.Command {
cmd := &cobra.Command{
Use: "builder",
Short: "Manage builds",
Args: cli.NoArgs,
RunE: command.ShowHelp(dockerCli.Err()),
Annotations: map[string]string{"version": "1.31"},
}
cmd.AddCommand(
NewPruneCommand(dockerC... | [
"func",
"NewBuilderCommand",
"(",
"dockerCli",
"command",
".",
"Cli",
")",
"*",
"cobra",
".",
"Command",
"{",
"cmd",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Args",
":",
"cli",
".",
"NoAr... | // NewBuilderCommand returns a cobra command for `builder` subcommands | [
"NewBuilderCommand",
"returns",
"a",
"cobra",
"command",
"for",
"builder",
"subcommands"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/builder/cmd.go#L12-L25 |
159,901 | docker/cli | cli/command/context/remove.go | RunRemove | func RunRemove(dockerCli command.Cli, opts RemoveOptions, names []string) error {
var errs []string
currentCtx := dockerCli.CurrentContext()
for _, name := range names {
if name == "default" {
errs = append(errs, `default: context "default" cannot be removed`)
} else if err := doRemove(dockerCli, name, name =... | go | func RunRemove(dockerCli command.Cli, opts RemoveOptions, names []string) error {
var errs []string
currentCtx := dockerCli.CurrentContext()
for _, name := range names {
if name == "default" {
errs = append(errs, `default: context "default" cannot be removed`)
} else if err := doRemove(dockerCli, name, name =... | [
"func",
"RunRemove",
"(",
"dockerCli",
"command",
".",
"Cli",
",",
"opts",
"RemoveOptions",
",",
"names",
"[",
"]",
"string",
")",
"error",
"{",
"var",
"errs",
"[",
"]",
"string",
"\n",
"currentCtx",
":=",
"dockerCli",
".",
"CurrentContext",
"(",
")",
"\... | // RunRemove removes one or more contexts | [
"RunRemove",
"removes",
"one",
"or",
"more",
"contexts"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/context/remove.go#L34-L50 |
159,902 | docker/cli | cli/command/container/rename.go | NewRenameCommand | func NewRenameCommand(dockerCli command.Cli) *cobra.Command {
var opts renameOptions
cmd := &cobra.Command{
Use: "rename CONTAINER NEW_NAME",
Short: "Rename a container",
Args: cli.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
opts.oldName = args[0]
opts.newName = args[1]
re... | go | func NewRenameCommand(dockerCli command.Cli) *cobra.Command {
var opts renameOptions
cmd := &cobra.Command{
Use: "rename CONTAINER NEW_NAME",
Short: "Rename a container",
Args: cli.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
opts.oldName = args[0]
opts.newName = args[1]
re... | [
"func",
"NewRenameCommand",
"(",
"dockerCli",
"command",
".",
"Cli",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"opts",
"renameOptions",
"\n\n",
"cmd",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
... | // NewRenameCommand creates a new cobra.Command for `docker rename` | [
"NewRenameCommand",
"creates",
"a",
"new",
"cobra",
".",
"Command",
"for",
"docker",
"rename"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/container/rename.go#L20-L34 |
159,903 | docker/cli | cli/command/orchestrator.go | GetStackOrchestrator | func GetStackOrchestrator(flagValue, contextValue, globalDefault string, stderr io.Writer) (Orchestrator, error) {
// Check flag
if o, err := normalize(flagValue); o != orchestratorUnset {
return o, err
}
// Check environment variable
env := os.Getenv(envVarDockerStackOrchestrator)
if env == "" && os.Getenv(env... | go | func GetStackOrchestrator(flagValue, contextValue, globalDefault string, stderr io.Writer) (Orchestrator, error) {
// Check flag
if o, err := normalize(flagValue); o != orchestratorUnset {
return o, err
}
// Check environment variable
env := os.Getenv(envVarDockerStackOrchestrator)
if env == "" && os.Getenv(env... | [
"func",
"GetStackOrchestrator",
"(",
"flagValue",
",",
"contextValue",
",",
"globalDefault",
"string",
",",
"stderr",
"io",
".",
"Writer",
")",
"(",
"Orchestrator",
",",
"error",
")",
"{",
"// Check flag",
"if",
"o",
",",
"err",
":=",
"normalize",
"(",
"flag... | // GetStackOrchestrator checks DOCKER_STACK_ORCHESTRATOR environment variable and configuration file
// orchestrator value and returns user defined Orchestrator. | [
"GetStackOrchestrator",
"checks",
"DOCKER_STACK_ORCHESTRATOR",
"environment",
"variable",
"and",
"configuration",
"file",
"orchestrator",
"value",
"and",
"returns",
"user",
"defined",
"Orchestrator",
"."
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/orchestrator.go#L63-L84 |
159,904 | docker/cli | cli/streams/out.go | GetTtySize | func (o *Out) GetTtySize() (uint, uint) {
if !o.isTerminal {
return 0, 0
}
ws, err := term.GetWinsize(o.fd)
if err != nil {
logrus.Debugf("Error getting size: %s", err)
if ws == nil {
return 0, 0
}
}
return uint(ws.Height), uint(ws.Width)
} | go | func (o *Out) GetTtySize() (uint, uint) {
if !o.isTerminal {
return 0, 0
}
ws, err := term.GetWinsize(o.fd)
if err != nil {
logrus.Debugf("Error getting size: %s", err)
if ws == nil {
return 0, 0
}
}
return uint(ws.Height), uint(ws.Width)
} | [
"func",
"(",
"o",
"*",
"Out",
")",
"GetTtySize",
"(",
")",
"(",
"uint",
",",
"uint",
")",
"{",
"if",
"!",
"o",
".",
"isTerminal",
"{",
"return",
"0",
",",
"0",
"\n",
"}",
"\n",
"ws",
",",
"err",
":=",
"term",
".",
"GetWinsize",
"(",
"o",
".",... | // GetTtySize returns the height and width in characters of the tty | [
"GetTtySize",
"returns",
"the",
"height",
"and",
"width",
"in",
"characters",
"of",
"the",
"tty"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/streams/out.go#L32-L44 |
159,905 | docker/cli | cli/streams/out.go | NewOut | func NewOut(out io.Writer) *Out {
fd, isTerminal := term.GetFdInfo(out)
return &Out{commonStream: commonStream{fd: fd, isTerminal: isTerminal}, out: out}
} | go | func NewOut(out io.Writer) *Out {
fd, isTerminal := term.GetFdInfo(out)
return &Out{commonStream: commonStream{fd: fd, isTerminal: isTerminal}, out: out}
} | [
"func",
"NewOut",
"(",
"out",
"io",
".",
"Writer",
")",
"*",
"Out",
"{",
"fd",
",",
"isTerminal",
":=",
"term",
".",
"GetFdInfo",
"(",
"out",
")",
"\n",
"return",
"&",
"Out",
"{",
"commonStream",
":",
"commonStream",
"{",
"fd",
":",
"fd",
",",
"isT... | // NewOut returns a new Out object from a Writer | [
"NewOut",
"returns",
"a",
"new",
"Out",
"object",
"from",
"a",
"Writer"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/streams/out.go#L47-L50 |
159,906 | docker/cli | cli/compose/loader/loader.go | GetUnsupportedProperties | func GetUnsupportedProperties(configDicts ...map[string]interface{}) []string {
unsupported := map[string]bool{}
for _, configDict := range configDicts {
for _, service := range getServices(configDict) {
serviceDict := service.(map[string]interface{})
for _, property := range types.UnsupportedProperties {
... | go | func GetUnsupportedProperties(configDicts ...map[string]interface{}) []string {
unsupported := map[string]bool{}
for _, configDict := range configDicts {
for _, service := range getServices(configDict) {
serviceDict := service.(map[string]interface{})
for _, property := range types.UnsupportedProperties {
... | [
"func",
"GetUnsupportedProperties",
"(",
"configDicts",
"...",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"[",
"]",
"string",
"{",
"unsupported",
":=",
"map",
"[",
"string",
"]",
"bool",
"{",
"}",
"\n\n",
"for",
"_",
",",
"configDict",
":=",
... | // GetUnsupportedProperties returns the list of any unsupported properties that are
// used in the Compose files. | [
"GetUnsupportedProperties",
"returns",
"the",
"list",
"of",
"any",
"unsupported",
"properties",
"that",
"are",
"used",
"in",
"the",
"Compose",
"files",
"."
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/compose/loader/loader.go#L192-L207 |
159,907 | docker/cli | cli/compose/loader/loader.go | GetDeprecatedProperties | func GetDeprecatedProperties(configDicts ...map[string]interface{}) map[string]string {
deprecated := map[string]string{}
for _, configDict := range configDicts {
deprecatedProperties := getProperties(getServices(configDict), types.DeprecatedProperties)
for key, value := range deprecatedProperties {
deprecate... | go | func GetDeprecatedProperties(configDicts ...map[string]interface{}) map[string]string {
deprecated := map[string]string{}
for _, configDict := range configDicts {
deprecatedProperties := getProperties(getServices(configDict), types.DeprecatedProperties)
for key, value := range deprecatedProperties {
deprecate... | [
"func",
"GetDeprecatedProperties",
"(",
"configDicts",
"...",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"deprecated",
":=",
"map",
"[",
"string",
"]",
"string",
"{",
"}",
"\n\n",
"for",
"_",
",",
"... | // GetDeprecatedProperties returns the list of any deprecated properties that
// are used in the compose files. | [
"GetDeprecatedProperties",
"returns",
"the",
"list",
"of",
"any",
"deprecated",
"properties",
"that",
"are",
"used",
"in",
"the",
"compose",
"files",
"."
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/compose/loader/loader.go#L220-L231 |
159,908 | docker/cli | cli/compose/loader/loader.go | Transform | func Transform(source interface{}, target interface{}, additionalTransformers ...Transformer) error {
data := mapstructure.Metadata{}
config := &mapstructure.DecoderConfig{
DecodeHook: mapstructure.ComposeDecodeHookFunc(
createTransformHook(additionalTransformers...),
mapstructure.StringToTimeDurationHookFunc... | go | func Transform(source interface{}, target interface{}, additionalTransformers ...Transformer) error {
data := mapstructure.Metadata{}
config := &mapstructure.DecoderConfig{
DecodeHook: mapstructure.ComposeDecodeHookFunc(
createTransformHook(additionalTransformers...),
mapstructure.StringToTimeDurationHookFunc... | [
"func",
"Transform",
"(",
"source",
"interface",
"{",
"}",
",",
"target",
"interface",
"{",
"}",
",",
"additionalTransformers",
"...",
"Transformer",
")",
"error",
"{",
"data",
":=",
"mapstructure",
".",
"Metadata",
"{",
"}",
"\n",
"config",
":=",
"&",
"ma... | // Transform converts the source into the target struct with compose types transformer
// and the specified transformers if any. | [
"Transform",
"converts",
"the",
"source",
"into",
"the",
"target",
"struct",
"with",
"compose",
"types",
"transformer",
"and",
"the",
"specified",
"transformers",
"if",
"any",
"."
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/compose/loader/loader.go#L271-L285 |
159,909 | docker/cli | cli/compose/loader/loader.go | convertToStringKeysRecursive | func convertToStringKeysRecursive(value interface{}, keyPrefix string) (interface{}, error) {
if mapping, ok := value.(map[interface{}]interface{}); ok {
dict := make(map[string]interface{})
for key, entry := range mapping {
str, ok := key.(string)
if !ok {
return nil, formatInvalidKeyError(keyPrefix, ke... | go | func convertToStringKeysRecursive(value interface{}, keyPrefix string) (interface{}, error) {
if mapping, ok := value.(map[interface{}]interface{}); ok {
dict := make(map[string]interface{})
for key, entry := range mapping {
str, ok := key.(string)
if !ok {
return nil, formatInvalidKeyError(keyPrefix, ke... | [
"func",
"convertToStringKeysRecursive",
"(",
"value",
"interface",
"{",
"}",
",",
"keyPrefix",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"if",
"mapping",
",",
"ok",
":=",
"value",
".",
"(",
"map",
"[",
"interface",
"{",
"}",
"]... | // keys needs to be converted to strings for jsonschema | [
"keys",
"needs",
"to",
"be",
"converted",
"to",
"strings",
"for",
"jsonschema"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/compose/loader/loader.go#L331-L366 |
159,910 | docker/cli | cli/command/stack/kubernetes/deploy.go | RunDeploy | func RunDeploy(dockerCli *KubeCli, opts options.Deploy, cfg *composetypes.Config) error {
cmdOut := dockerCli.Out()
// Initialize clients
composeClient, err := dockerCli.composeClient()
if err != nil {
return err
}
stacks, err := composeClient.Stacks(false)
if err != nil {
return err
}
stack, err := stac... | go | func RunDeploy(dockerCli *KubeCli, opts options.Deploy, cfg *composetypes.Config) error {
cmdOut := dockerCli.Out()
// Initialize clients
composeClient, err := dockerCli.composeClient()
if err != nil {
return err
}
stacks, err := composeClient.Stacks(false)
if err != nil {
return err
}
stack, err := stac... | [
"func",
"RunDeploy",
"(",
"dockerCli",
"*",
"KubeCli",
",",
"opts",
"options",
".",
"Deploy",
",",
"cfg",
"*",
"composetypes",
".",
"Config",
")",
"error",
"{",
"cmdOut",
":=",
"dockerCli",
".",
"Out",
"(",
")",
"\n\n",
"// Initialize clients",
"composeClien... | // RunDeploy is the kubernetes implementation of docker stack deploy | [
"RunDeploy",
"is",
"the",
"kubernetes",
"implementation",
"of",
"docker",
"stack",
"deploy"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/stack/kubernetes/deploy.go#L15-L75 |
159,911 | docker/cli | cli/command/network/prune.go | RunPrune | func RunPrune(dockerCli command.Cli, all bool, filter opts.FilterOpt) (uint64, string, error) {
output, err := runPrune(dockerCli, pruneOptions{force: true, filter: filter})
return 0, output, err
} | go | func RunPrune(dockerCli command.Cli, all bool, filter opts.FilterOpt) (uint64, string, error) {
output, err := runPrune(dockerCli, pruneOptions{force: true, filter: filter})
return 0, output, err
} | [
"func",
"RunPrune",
"(",
"dockerCli",
"command",
".",
"Cli",
",",
"all",
"bool",
",",
"filter",
"opts",
".",
"FilterOpt",
")",
"(",
"uint64",
",",
"string",
",",
"error",
")",
"{",
"output",
",",
"err",
":=",
"runPrune",
"(",
"dockerCli",
",",
"pruneOp... | // RunPrune calls the Network Prune API
// This returns the amount of space reclaimed and a detailed output string | [
"RunPrune",
"calls",
"the",
"Network",
"Prune",
"API",
"This",
"returns",
"the",
"amount",
"of",
"space",
"reclaimed",
"and",
"a",
"detailed",
"output",
"string"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/network/prune.go#L73-L76 |
159,912 | docker/cli | cli/command/image/list.go | NewImagesCommand | func NewImagesCommand(dockerCli command.Cli) *cobra.Command {
options := imagesOptions{filter: opts.NewFilterOpt()}
cmd := &cobra.Command{
Use: "images [OPTIONS] [REPOSITORY[:TAG]]",
Short: "List images",
Args: cli.RequiresMaxArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) >... | go | func NewImagesCommand(dockerCli command.Cli) *cobra.Command {
options := imagesOptions{filter: opts.NewFilterOpt()}
cmd := &cobra.Command{
Use: "images [OPTIONS] [REPOSITORY[:TAG]]",
Short: "List images",
Args: cli.RequiresMaxArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) >... | [
"func",
"NewImagesCommand",
"(",
"dockerCli",
"command",
".",
"Cli",
")",
"*",
"cobra",
".",
"Command",
"{",
"options",
":=",
"imagesOptions",
"{",
"filter",
":",
"opts",
".",
"NewFilterOpt",
"(",
")",
"}",
"\n\n",
"cmd",
":=",
"&",
"cobra",
".",
"Comman... | // NewImagesCommand creates a new `docker images` command | [
"NewImagesCommand",
"creates",
"a",
"new",
"docker",
"images",
"command"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/image/list.go#L26-L51 |
159,913 | docker/cli | cli/command/config/formatter.go | NewFormat | func NewFormat(source string, quiet bool) formatter.Format {
switch source {
case formatter.PrettyFormatKey:
return configInspectPrettyTemplate
case formatter.TableFormatKey:
if quiet {
return formatter.DefaultQuietFormat
}
return defaultConfigTableFormat
}
return formatter.Format(source)
} | go | func NewFormat(source string, quiet bool) formatter.Format {
switch source {
case formatter.PrettyFormatKey:
return configInspectPrettyTemplate
case formatter.TableFormatKey:
if quiet {
return formatter.DefaultQuietFormat
}
return defaultConfigTableFormat
}
return formatter.Format(source)
} | [
"func",
"NewFormat",
"(",
"source",
"string",
",",
"quiet",
"bool",
")",
"formatter",
".",
"Format",
"{",
"switch",
"source",
"{",
"case",
"formatter",
".",
"PrettyFormatKey",
":",
"return",
"configInspectPrettyTemplate",
"\n",
"case",
"formatter",
".",
"TableFo... | // NewFormat returns a Format for rendering using a config Context | [
"NewFormat",
"returns",
"a",
"Format",
"for",
"rendering",
"using",
"a",
"config",
"Context"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/config/formatter.go#L34-L45 |
159,914 | docker/cli | cli/command/config/formatter.go | InspectFormatWrite | func InspectFormatWrite(ctx formatter.Context, refs []string, getRef inspect.GetRefFunc) error {
if ctx.Format != configInspectPrettyTemplate {
return inspect.Inspect(ctx.Output, refs, string(ctx.Format), getRef)
}
render := func(format func(subContext formatter.SubContext) error) error {
for _, ref := range ref... | go | func InspectFormatWrite(ctx formatter.Context, refs []string, getRef inspect.GetRefFunc) error {
if ctx.Format != configInspectPrettyTemplate {
return inspect.Inspect(ctx.Output, refs, string(ctx.Format), getRef)
}
render := func(format func(subContext formatter.SubContext) error) error {
for _, ref := range ref... | [
"func",
"InspectFormatWrite",
"(",
"ctx",
"formatter",
".",
"Context",
",",
"refs",
"[",
"]",
"string",
",",
"getRef",
"inspect",
".",
"GetRefFunc",
")",
"error",
"{",
"if",
"ctx",
".",
"Format",
"!=",
"configInspectPrettyTemplate",
"{",
"return",
"inspect",
... | // InspectFormatWrite renders the context for a list of configs | [
"InspectFormatWrite",
"renders",
"the",
"context",
"for",
"a",
"list",
"of",
"configs"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/config/formatter.go#L119-L140 |
159,915 | docker/cli | cli/command/formatter/disk_usage.go | NewDiskUsageFormat | func NewDiskUsageFormat(source string, verbose bool) Format {
switch {
case verbose && source == RawFormatKey:
format := `{{range .Images}}type: Image
` + NewImageFormat(source, false, true) + `
{{end -}}
{{range .Containers}}type: Container
` + NewContainerFormat(source, false, true) + `
{{end -}}
{{range .Volumes... | go | func NewDiskUsageFormat(source string, verbose bool) Format {
switch {
case verbose && source == RawFormatKey:
format := `{{range .Images}}type: Image
` + NewImageFormat(source, false, true) + `
{{end -}}
{{range .Containers}}type: Container
` + NewContainerFormat(source, false, true) + `
{{end -}}
{{range .Volumes... | [
"func",
"NewDiskUsageFormat",
"(",
"source",
"string",
",",
"verbose",
"bool",
")",
"Format",
"{",
"switch",
"{",
"case",
"verbose",
"&&",
"source",
"==",
"RawFormatKey",
":",
"format",
":=",
"`{{range .Images}}type: Image\n`",
"+",
"NewImageFormat",
"(",
"source"... | // NewDiskUsageFormat returns a format for rendering an DiskUsageContext | [
"NewDiskUsageFormat",
"returns",
"a",
"format",
"for",
"rendering",
"an",
"DiskUsageContext"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/formatter/disk_usage.go#L52-L81 |
159,916 | docker/cli | cli/command/container/diff.go | NewDiffCommand | func NewDiffCommand(dockerCli command.Cli) *cobra.Command {
var opts diffOptions
return &cobra.Command{
Use: "diff CONTAINER",
Short: "Inspect changes to files or directories on a container's filesystem",
Args: cli.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
opts.container = arg... | go | func NewDiffCommand(dockerCli command.Cli) *cobra.Command {
var opts diffOptions
return &cobra.Command{
Use: "diff CONTAINER",
Short: "Inspect changes to files or directories on a container's filesystem",
Args: cli.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
opts.container = arg... | [
"func",
"NewDiffCommand",
"(",
"dockerCli",
"command",
".",
"Cli",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"opts",
"diffOptions",
"\n\n",
"return",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
... | // NewDiffCommand creates a new cobra.Command for `docker diff` | [
"NewDiffCommand",
"creates",
"a",
"new",
"cobra",
".",
"Command",
"for",
"docker",
"diff"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/container/diff.go#L18-L30 |
159,917 | docker/cli | cli/compose/schema/bindata.go | _escDir | func _escDir(useLocal bool, name string) http.FileSystem {
if useLocal {
return _escDirectory{fs: _escLocal, name: name}
}
return _escDirectory{fs: _escStatic, name: name}
} | go | func _escDir(useLocal bool, name string) http.FileSystem {
if useLocal {
return _escDirectory{fs: _escLocal, name: name}
}
return _escDirectory{fs: _escStatic, name: name}
} | [
"func",
"_escDir",
"(",
"useLocal",
"bool",
",",
"name",
"string",
")",
"http",
".",
"FileSystem",
"{",
"if",
"useLocal",
"{",
"return",
"_escDirectory",
"{",
"fs",
":",
"_escLocal",
",",
"name",
":",
"name",
"}",
"\n",
"}",
"\n",
"return",
"_escDirector... | // _escDir returns a http.Filesystem for the embedded assets on a given prefix dir.
// If useLocal is true, the filesystem's contents are instead used. | [
"_escDir",
"returns",
"a",
"http",
".",
"Filesystem",
"for",
"the",
"embedded",
"assets",
"on",
"a",
"given",
"prefix",
"dir",
".",
"If",
"useLocal",
"is",
"true",
"the",
"filesystem",
"s",
"contents",
"are",
"instead",
"used",
"."
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/compose/schema/bindata.go#L145-L150 |
159,918 | docker/cli | cli/compose/schema/bindata.go | _escFSMustByte | func _escFSMustByte(useLocal bool, name string) []byte {
b, err := _escFSByte(useLocal, name)
if err != nil {
panic(err)
}
return b
} | go | func _escFSMustByte(useLocal bool, name string) []byte {
b, err := _escFSByte(useLocal, name)
if err != nil {
panic(err)
}
return b
} | [
"func",
"_escFSMustByte",
"(",
"useLocal",
"bool",
",",
"name",
"string",
")",
"[",
"]",
"byte",
"{",
"b",
",",
"err",
":=",
"_escFSByte",
"(",
"useLocal",
",",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
... | // _escFSMustByte is the same as _escFSByte, but panics if name is not present. | [
"_escFSMustByte",
"is",
"the",
"same",
"as",
"_escFSByte",
"but",
"panics",
"if",
"name",
"is",
"not",
"present",
"."
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/compose/schema/bindata.go#L172-L178 |
159,919 | docker/cli | cli/compose/schema/bindata.go | _escFSString | func _escFSString(useLocal bool, name string) (string, error) {
b, err := _escFSByte(useLocal, name)
return string(b), err
} | go | func _escFSString(useLocal bool, name string) (string, error) {
b, err := _escFSByte(useLocal, name)
return string(b), err
} | [
"func",
"_escFSString",
"(",
"useLocal",
"bool",
",",
"name",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"b",
",",
"err",
":=",
"_escFSByte",
"(",
"useLocal",
",",
"name",
")",
"\n",
"return",
"string",
"(",
"b",
")",
",",
"err",
"\n",
"... | // _escFSString is the string version of _escFSByte. | [
"_escFSString",
"is",
"the",
"string",
"version",
"of",
"_escFSByte",
"."
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/compose/schema/bindata.go#L181-L184 |
159,920 | docker/cli | cli/compose/schema/bindata.go | _escFSMustString | func _escFSMustString(useLocal bool, name string) string {
return string(_escFSMustByte(useLocal, name))
} | go | func _escFSMustString(useLocal bool, name string) string {
return string(_escFSMustByte(useLocal, name))
} | [
"func",
"_escFSMustString",
"(",
"useLocal",
"bool",
",",
"name",
"string",
")",
"string",
"{",
"return",
"string",
"(",
"_escFSMustByte",
"(",
"useLocal",
",",
"name",
")",
")",
"\n",
"}"
] | // _escFSMustString is the string version of _escFSMustByte. | [
"_escFSMustString",
"is",
"the",
"string",
"version",
"of",
"_escFSMustByte",
"."
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/compose/schema/bindata.go#L187-L189 |
159,921 | docker/cli | cli/flags/common.go | InstallFlags | func (commonOpts *CommonOptions) InstallFlags(flags *pflag.FlagSet) {
if dockerCertPath == "" {
dockerCertPath = cliconfig.Dir()
}
flags.BoolVarP(&commonOpts.Debug, "debug", "D", false, "Enable debug mode")
flags.StringVarP(&commonOpts.LogLevel, "log-level", "l", "info", `Set the logging level ("debug"|"info"|"w... | go | func (commonOpts *CommonOptions) InstallFlags(flags *pflag.FlagSet) {
if dockerCertPath == "" {
dockerCertPath = cliconfig.Dir()
}
flags.BoolVarP(&commonOpts.Debug, "debug", "D", false, "Enable debug mode")
flags.StringVarP(&commonOpts.LogLevel, "log-level", "l", "info", `Set the logging level ("debug"|"info"|"w... | [
"func",
"(",
"commonOpts",
"*",
"CommonOptions",
")",
"InstallFlags",
"(",
"flags",
"*",
"pflag",
".",
"FlagSet",
")",
"{",
"if",
"dockerCertPath",
"==",
"\"",
"\"",
"{",
"dockerCertPath",
"=",
"cliconfig",
".",
"Dir",
"(",
")",
"\n",
"}",
"\n\n",
"flags... | // InstallFlags adds flags for the common options on the FlagSet | [
"InstallFlags",
"adds",
"flags",
"for",
"the",
"common",
"options",
"on",
"the",
"FlagSet"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/flags/common.go#L49-L76 |
159,922 | docker/cli | cli/flags/common.go | SetDefaultOptions | func (commonOpts *CommonOptions) SetDefaultOptions(flags *pflag.FlagSet) {
// Regardless of whether the user sets it to true or false, if they
// specify --tlsverify at all then we need to turn on TLS
// TLSVerify can be true even if not set due to DOCKER_TLS_VERIFY env var, so we need
// to check that here as well... | go | func (commonOpts *CommonOptions) SetDefaultOptions(flags *pflag.FlagSet) {
// Regardless of whether the user sets it to true or false, if they
// specify --tlsverify at all then we need to turn on TLS
// TLSVerify can be true even if not set due to DOCKER_TLS_VERIFY env var, so we need
// to check that here as well... | [
"func",
"(",
"commonOpts",
"*",
"CommonOptions",
")",
"SetDefaultOptions",
"(",
"flags",
"*",
"pflag",
".",
"FlagSet",
")",
"{",
"// Regardless of whether the user sets it to true or false, if they",
"// specify --tlsverify at all then we need to turn on TLS",
"// TLSVerify can be ... | // SetDefaultOptions sets default values for options after flag parsing is
// complete | [
"SetDefaultOptions",
"sets",
"default",
"values",
"for",
"options",
"after",
"flag",
"parsing",
"is",
"complete"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/flags/common.go#L80-L108 |
159,923 | docker/cli | cli/context/tlsdata.go | ToStoreTLSData | func (data *TLSData) ToStoreTLSData() *store.EndpointTLSData {
if data == nil {
return nil
}
result := store.EndpointTLSData{
Files: make(map[string][]byte),
}
if data.CA != nil {
result.Files[caKey] = data.CA
}
if data.Cert != nil {
result.Files[certKey] = data.Cert
}
if data.Key != nil {
result.Fil... | go | func (data *TLSData) ToStoreTLSData() *store.EndpointTLSData {
if data == nil {
return nil
}
result := store.EndpointTLSData{
Files: make(map[string][]byte),
}
if data.CA != nil {
result.Files[caKey] = data.CA
}
if data.Cert != nil {
result.Files[certKey] = data.Cert
}
if data.Key != nil {
result.Fil... | [
"func",
"(",
"data",
"*",
"TLSData",
")",
"ToStoreTLSData",
"(",
")",
"*",
"store",
".",
"EndpointTLSData",
"{",
"if",
"data",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"result",
":=",
"store",
".",
"EndpointTLSData",
"{",
"Files",
":",
"make... | // ToStoreTLSData converts TLSData to the store representation | [
"ToStoreTLSData",
"converts",
"TLSData",
"to",
"the",
"store",
"representation"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/context/tlsdata.go#L25-L42 |
159,924 | docker/cli | cli/context/tlsdata.go | LoadTLSData | func LoadTLSData(s store.Reader, contextName, endpointName string) (*TLSData, error) {
tlsFiles, err := s.ListTLSFiles(contextName)
if err != nil {
return nil, errors.Wrapf(err, "failed to retrieve context tls files for context %q", contextName)
}
if epTLSFiles, ok := tlsFiles[endpointName]; ok {
var tlsData TL... | go | func LoadTLSData(s store.Reader, contextName, endpointName string) (*TLSData, error) {
tlsFiles, err := s.ListTLSFiles(contextName)
if err != nil {
return nil, errors.Wrapf(err, "failed to retrieve context tls files for context %q", contextName)
}
if epTLSFiles, ok := tlsFiles[endpointName]; ok {
var tlsData TL... | [
"func",
"LoadTLSData",
"(",
"s",
"store",
".",
"Reader",
",",
"contextName",
",",
"endpointName",
"string",
")",
"(",
"*",
"TLSData",
",",
"error",
")",
"{",
"tlsFiles",
",",
"err",
":=",
"s",
".",
"ListTLSFiles",
"(",
"contextName",
")",
"\n",
"if",
"... | // LoadTLSData loads TLS data from the store | [
"LoadTLSData",
"loads",
"TLS",
"data",
"from",
"the",
"store"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/context/tlsdata.go#L45-L71 |
159,925 | docker/cli | cli/command/image/prune.go | NewPruneCommand | func NewPruneCommand(dockerCli command.Cli) *cobra.Command {
options := pruneOptions{filter: opts.NewFilterOpt()}
cmd := &cobra.Command{
Use: "prune [OPTIONS]",
Short: "Remove unused images",
Args: cli.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
spaceReclaimed, output, err := runPrune... | go | func NewPruneCommand(dockerCli command.Cli) *cobra.Command {
options := pruneOptions{filter: opts.NewFilterOpt()}
cmd := &cobra.Command{
Use: "prune [OPTIONS]",
Short: "Remove unused images",
Args: cli.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
spaceReclaimed, output, err := runPrune... | [
"func",
"NewPruneCommand",
"(",
"dockerCli",
"command",
".",
"Cli",
")",
"*",
"cobra",
".",
"Command",
"{",
"options",
":=",
"pruneOptions",
"{",
"filter",
":",
"opts",
".",
"NewFilterOpt",
"(",
")",
"}",
"\n\n",
"cmd",
":=",
"&",
"cobra",
".",
"Command"... | // NewPruneCommand returns a new cobra prune command for images | [
"NewPruneCommand",
"returns",
"a",
"new",
"cobra",
"prune",
"command",
"for",
"images"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/image/prune.go#L22-L49 |
159,926 | docker/cli | cli/command/stack/kubernetes/client.go | NewFactory | func NewFactory(namespace string, config *restclient.Config, clientSet *kubeclient.Clientset, experimental bool) (*Factory, error) {
coreClientSet, err := corev1.NewForConfig(config)
if err != nil {
return nil, err
}
appsClientSet, err := appsv1beta2.NewForConfig(config)
if err != nil {
return nil, err
}
r... | go | func NewFactory(namespace string, config *restclient.Config, clientSet *kubeclient.Clientset, experimental bool) (*Factory, error) {
coreClientSet, err := corev1.NewForConfig(config)
if err != nil {
return nil, err
}
appsClientSet, err := appsv1beta2.NewForConfig(config)
if err != nil {
return nil, err
}
r... | [
"func",
"NewFactory",
"(",
"namespace",
"string",
",",
"config",
"*",
"restclient",
".",
"Config",
",",
"clientSet",
"*",
"kubeclient",
".",
"Clientset",
",",
"experimental",
"bool",
")",
"(",
"*",
"Factory",
",",
"error",
")",
"{",
"coreClientSet",
",",
"... | // NewFactory creates a kubernetes client factory | [
"NewFactory",
"creates",
"a",
"kubernetes",
"client",
"factory"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/stack/kubernetes/client.go#L25-L44 |
159,927 | docker/cli | cli/command/stack/kubernetes/client.go | ConfigMaps | func (s *Factory) ConfigMaps() corev1.ConfigMapInterface {
return s.coreClientSet.ConfigMaps(s.namespace)
} | go | func (s *Factory) ConfigMaps() corev1.ConfigMapInterface {
return s.coreClientSet.ConfigMaps(s.namespace)
} | [
"func",
"(",
"s",
"*",
"Factory",
")",
"ConfigMaps",
"(",
")",
"corev1",
".",
"ConfigMapInterface",
"{",
"return",
"s",
".",
"coreClientSet",
".",
"ConfigMaps",
"(",
"s",
".",
"namespace",
")",
"\n",
"}"
] | // ConfigMaps returns a client for kubernetes's config maps | [
"ConfigMaps",
"returns",
"a",
"client",
"for",
"kubernetes",
"s",
"config",
"maps"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/stack/kubernetes/client.go#L47-L49 |
159,928 | docker/cli | cli/command/stack/kubernetes/client.go | Secrets | func (s *Factory) Secrets() corev1.SecretInterface {
return s.coreClientSet.Secrets(s.namespace)
} | go | func (s *Factory) Secrets() corev1.SecretInterface {
return s.coreClientSet.Secrets(s.namespace)
} | [
"func",
"(",
"s",
"*",
"Factory",
")",
"Secrets",
"(",
")",
"corev1",
".",
"SecretInterface",
"{",
"return",
"s",
".",
"coreClientSet",
".",
"Secrets",
"(",
"s",
".",
"namespace",
")",
"\n",
"}"
] | // Secrets returns a client for kubernetes's secrets | [
"Secrets",
"returns",
"a",
"client",
"for",
"kubernetes",
"s",
"secrets"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/stack/kubernetes/client.go#L52-L54 |
159,929 | docker/cli | cli/command/stack/kubernetes/client.go | Services | func (s *Factory) Services() corev1.ServiceInterface {
return s.coreClientSet.Services(s.namespace)
} | go | func (s *Factory) Services() corev1.ServiceInterface {
return s.coreClientSet.Services(s.namespace)
} | [
"func",
"(",
"s",
"*",
"Factory",
")",
"Services",
"(",
")",
"corev1",
".",
"ServiceInterface",
"{",
"return",
"s",
".",
"coreClientSet",
".",
"Services",
"(",
"s",
".",
"namespace",
")",
"\n",
"}"
] | // Services returns a client for kubernetes's secrets | [
"Services",
"returns",
"a",
"client",
"for",
"kubernetes",
"s",
"secrets"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/stack/kubernetes/client.go#L57-L59 |
159,930 | docker/cli | cli/command/stack/kubernetes/client.go | Pods | func (s *Factory) Pods() corev1.PodInterface {
return s.coreClientSet.Pods(s.namespace)
} | go | func (s *Factory) Pods() corev1.PodInterface {
return s.coreClientSet.Pods(s.namespace)
} | [
"func",
"(",
"s",
"*",
"Factory",
")",
"Pods",
"(",
")",
"corev1",
".",
"PodInterface",
"{",
"return",
"s",
".",
"coreClientSet",
".",
"Pods",
"(",
"s",
".",
"namespace",
")",
"\n",
"}"
] | // Pods returns a client for kubernetes's pods | [
"Pods",
"returns",
"a",
"client",
"for",
"kubernetes",
"s",
"pods"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/stack/kubernetes/client.go#L62-L64 |
159,931 | docker/cli | cli/command/stack/kubernetes/client.go | ReplicationControllers | func (s *Factory) ReplicationControllers() corev1.ReplicationControllerInterface {
return s.coreClientSet.ReplicationControllers(s.namespace)
} | go | func (s *Factory) ReplicationControllers() corev1.ReplicationControllerInterface {
return s.coreClientSet.ReplicationControllers(s.namespace)
} | [
"func",
"(",
"s",
"*",
"Factory",
")",
"ReplicationControllers",
"(",
")",
"corev1",
".",
"ReplicationControllerInterface",
"{",
"return",
"s",
".",
"coreClientSet",
".",
"ReplicationControllers",
"(",
"s",
".",
"namespace",
")",
"\n",
"}"
] | // ReplicationControllers returns a client for kubernetes replication controllers | [
"ReplicationControllers",
"returns",
"a",
"client",
"for",
"kubernetes",
"replication",
"controllers"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/stack/kubernetes/client.go#L72-L74 |
159,932 | docker/cli | cli/command/stack/kubernetes/client.go | ReplicaSets | func (s *Factory) ReplicaSets() typesappsv1beta2.ReplicaSetInterface {
return s.appsClientSet.ReplicaSets(s.namespace)
} | go | func (s *Factory) ReplicaSets() typesappsv1beta2.ReplicaSetInterface {
return s.appsClientSet.ReplicaSets(s.namespace)
} | [
"func",
"(",
"s",
"*",
"Factory",
")",
"ReplicaSets",
"(",
")",
"typesappsv1beta2",
".",
"ReplicaSetInterface",
"{",
"return",
"s",
".",
"appsClientSet",
".",
"ReplicaSets",
"(",
"s",
".",
"namespace",
")",
"\n",
"}"
] | // ReplicaSets returns a client for kubernetes replace sets | [
"ReplicaSets",
"returns",
"a",
"client",
"for",
"kubernetes",
"replace",
"sets"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/stack/kubernetes/client.go#L77-L79 |
159,933 | docker/cli | cli/command/stack/kubernetes/client.go | DaemonSets | func (s *Factory) DaemonSets() typesappsv1beta2.DaemonSetInterface {
return s.appsClientSet.DaemonSets(s.namespace)
} | go | func (s *Factory) DaemonSets() typesappsv1beta2.DaemonSetInterface {
return s.appsClientSet.DaemonSets(s.namespace)
} | [
"func",
"(",
"s",
"*",
"Factory",
")",
"DaemonSets",
"(",
")",
"typesappsv1beta2",
".",
"DaemonSetInterface",
"{",
"return",
"s",
".",
"appsClientSet",
".",
"DaemonSets",
"(",
"s",
".",
"namespace",
")",
"\n",
"}"
] | // DaemonSets returns a client for kubernetes daemon sets | [
"DaemonSets",
"returns",
"a",
"client",
"for",
"kubernetes",
"daemon",
"sets"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/stack/kubernetes/client.go#L82-L84 |
159,934 | docker/cli | cli/command/stack/kubernetes/client.go | Stacks | func (s *Factory) Stacks(allNamespaces bool) (StackClient, error) {
version, err := kubernetes.GetStackAPIVersion(s.clientSet.Discovery(), s.experimental)
if err != nil {
return nil, err
}
namespace := s.namespace
if allNamespaces {
namespace = metav1.NamespaceAll
}
switch version {
case kubernetes.StackAP... | go | func (s *Factory) Stacks(allNamespaces bool) (StackClient, error) {
version, err := kubernetes.GetStackAPIVersion(s.clientSet.Discovery(), s.experimental)
if err != nil {
return nil, err
}
namespace := s.namespace
if allNamespaces {
namespace = metav1.NamespaceAll
}
switch version {
case kubernetes.StackAP... | [
"func",
"(",
"s",
"*",
"Factory",
")",
"Stacks",
"(",
"allNamespaces",
"bool",
")",
"(",
"StackClient",
",",
"error",
")",
"{",
"version",
",",
"err",
":=",
"kubernetes",
".",
"GetStackAPIVersion",
"(",
"s",
".",
"clientSet",
".",
"Discovery",
"(",
")",
... | // Stacks returns a client for Docker's Stack on Kubernetes | [
"Stacks",
"returns",
"a",
"client",
"for",
"Docker",
"s",
"Stack",
"on",
"Kubernetes"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/stack/kubernetes/client.go#L87-L107 |
159,935 | docker/cli | cli/command/trust.go | AddTrustVerificationFlags | func AddTrustVerificationFlags(fs *pflag.FlagSet, v *bool, trusted bool) {
fs.BoolVar(v, "disable-content-trust", !trusted, "Skip image verification")
} | go | func AddTrustVerificationFlags(fs *pflag.FlagSet, v *bool, trusted bool) {
fs.BoolVar(v, "disable-content-trust", !trusted, "Skip image verification")
} | [
"func",
"AddTrustVerificationFlags",
"(",
"fs",
"*",
"pflag",
".",
"FlagSet",
",",
"v",
"*",
"bool",
",",
"trusted",
"bool",
")",
"{",
"fs",
".",
"BoolVar",
"(",
"v",
",",
"\"",
"\"",
",",
"!",
"trusted",
",",
"\"",
"\"",
")",
"\n",
"}"
] | // AddTrustVerificationFlags adds content trust flags to the provided flagset | [
"AddTrustVerificationFlags",
"adds",
"content",
"trust",
"flags",
"to",
"the",
"provided",
"flagset"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/trust.go#L8-L10 |
159,936 | docker/cli | cli/command/trust.go | AddTrustSigningFlags | func AddTrustSigningFlags(fs *pflag.FlagSet, v *bool, trusted bool) {
fs.BoolVar(v, "disable-content-trust", !trusted, "Skip image signing")
} | go | func AddTrustSigningFlags(fs *pflag.FlagSet, v *bool, trusted bool) {
fs.BoolVar(v, "disable-content-trust", !trusted, "Skip image signing")
} | [
"func",
"AddTrustSigningFlags",
"(",
"fs",
"*",
"pflag",
".",
"FlagSet",
",",
"v",
"*",
"bool",
",",
"trusted",
"bool",
")",
"{",
"fs",
".",
"BoolVar",
"(",
"v",
",",
"\"",
"\"",
",",
"!",
"trusted",
",",
"\"",
"\"",
")",
"\n",
"}"
] | // AddTrustSigningFlags adds "signing" flags to the provided flagset | [
"AddTrustSigningFlags",
"adds",
"signing",
"flags",
"to",
"the",
"provided",
"flagset"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/trust.go#L13-L15 |
159,937 | docker/cli | cli/command/engine/updates.go | NewUpdatesFormat | func NewUpdatesFormat(source string, quiet bool) formatter.Format {
switch source {
case formatter.TableFormatKey:
if quiet {
return defaultUpdatesQuietFormat
}
return defaultUpdatesTableFormat
case formatter.RawFormatKey:
if quiet {
return `update_version: {{.Version}}`
}
return `update_version: {... | go | func NewUpdatesFormat(source string, quiet bool) formatter.Format {
switch source {
case formatter.TableFormatKey:
if quiet {
return defaultUpdatesQuietFormat
}
return defaultUpdatesTableFormat
case formatter.RawFormatKey:
if quiet {
return `update_version: {{.Version}}`
}
return `update_version: {... | [
"func",
"NewUpdatesFormat",
"(",
"source",
"string",
",",
"quiet",
"bool",
")",
"formatter",
".",
"Format",
"{",
"switch",
"source",
"{",
"case",
"formatter",
".",
"TableFormatKey",
":",
"if",
"quiet",
"{",
"return",
"defaultUpdatesQuietFormat",
"\n",
"}",
"\n... | // NewUpdatesFormat returns a Format for rendering using a updates context | [
"NewUpdatesFormat",
"returns",
"a",
"Format",
"for",
"rendering",
"using",
"a",
"updates",
"context"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/engine/updates.go#L18-L32 |
159,938 | docker/cli | cli/command/engine/updates.go | UpdatesWrite | func UpdatesWrite(ctx formatter.Context, availableUpdates []clitypes.Update) error {
render := func(format func(subContext formatter.SubContext) error) error {
for _, update := range availableUpdates {
updatesCtx := &updateContext{trunc: ctx.Trunc, u: update}
if err := format(updatesCtx); err != nil {
retu... | go | func UpdatesWrite(ctx formatter.Context, availableUpdates []clitypes.Update) error {
render := func(format func(subContext formatter.SubContext) error) error {
for _, update := range availableUpdates {
updatesCtx := &updateContext{trunc: ctx.Trunc, u: update}
if err := format(updatesCtx); err != nil {
retu... | [
"func",
"UpdatesWrite",
"(",
"ctx",
"formatter",
".",
"Context",
",",
"availableUpdates",
"[",
"]",
"clitypes",
".",
"Update",
")",
"error",
"{",
"render",
":=",
"func",
"(",
"format",
"func",
"(",
"subContext",
"formatter",
".",
"SubContext",
")",
"error",
... | // UpdatesWrite writes the context | [
"UpdatesWrite",
"writes",
"the",
"context"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/engine/updates.go#L35-L52 |
159,939 | docker/cli | cli/command/container/wait.go | NewWaitCommand | func NewWaitCommand(dockerCli command.Cli) *cobra.Command {
var opts waitOptions
cmd := &cobra.Command{
Use: "wait CONTAINER [CONTAINER...]",
Short: "Block until one or more containers stop, then print their exit codes",
Args: cli.RequiresMinArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
... | go | func NewWaitCommand(dockerCli command.Cli) *cobra.Command {
var opts waitOptions
cmd := &cobra.Command{
Use: "wait CONTAINER [CONTAINER...]",
Short: "Block until one or more containers stop, then print their exit codes",
Args: cli.RequiresMinArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
... | [
"func",
"NewWaitCommand",
"(",
"dockerCli",
"command",
".",
"Cli",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"opts",
"waitOptions",
"\n\n",
"cmd",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",... | // NewWaitCommand creates a new cobra.Command for `docker wait` | [
"NewWaitCommand",
"creates",
"a",
"new",
"cobra",
".",
"Command",
"for",
"docker",
"wait"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/container/wait.go#L19-L33 |
159,940 | docker/cli | opts/weightdevice.go | ValidateWeightDevice | func ValidateWeightDevice(val string) (*blkiodev.WeightDevice, 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)
}
weight, err := strconv.Pa... | go | func ValidateWeightDevice(val string) (*blkiodev.WeightDevice, 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)
}
weight, err := strconv.Pa... | [
"func",
"ValidateWeightDevice",
"(",
"val",
"string",
")",
"(",
"*",
"blkiodev",
".",
"WeightDevice",
",",
"error",
")",
"{",
"split",
":=",
"strings",
".",
"SplitN",
"(",
"val",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"if",
"len",
"(",
"split",
")",
... | // ValidateWeightDevice validates that the specified string has a valid device-weight format. | [
"ValidateWeightDevice",
"validates",
"that",
"the",
"specified",
"string",
"has",
"a",
"valid",
"device",
"-",
"weight",
"format",
"."
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/opts/weightdevice.go#L15-L35 |
159,941 | docker/cli | opts/weightdevice.go | NewWeightdeviceOpt | func NewWeightdeviceOpt(validator ValidatorWeightFctType) WeightdeviceOpt {
values := []*blkiodev.WeightDevice{}
return WeightdeviceOpt{
values: values,
validator: validator,
}
} | go | func NewWeightdeviceOpt(validator ValidatorWeightFctType) WeightdeviceOpt {
values := []*blkiodev.WeightDevice{}
return WeightdeviceOpt{
values: values,
validator: validator,
}
} | [
"func",
"NewWeightdeviceOpt",
"(",
"validator",
"ValidatorWeightFctType",
")",
"WeightdeviceOpt",
"{",
"values",
":=",
"[",
"]",
"*",
"blkiodev",
".",
"WeightDevice",
"{",
"}",
"\n",
"return",
"WeightdeviceOpt",
"{",
"values",
":",
"values",
",",
"validator",
":... | // NewWeightdeviceOpt creates a new WeightdeviceOpt | [
"NewWeightdeviceOpt",
"creates",
"a",
"new",
"WeightdeviceOpt"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/opts/weightdevice.go#L44-L50 |
159,942 | docker/cli | opts/weightdevice.go | Set | func (opt *WeightdeviceOpt) Set(val string) error {
var value *blkiodev.WeightDevice
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 *WeightdeviceOpt) Set(val string) error {
var value *blkiodev.WeightDevice
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",
"*",
"WeightdeviceOpt",
")",
"Set",
"(",
"val",
"string",
")",
"error",
"{",
"var",
"value",
"*",
"blkiodev",
".",
"WeightDevice",
"\n",
"if",
"opt",
".",
"validator",
"!=",
"nil",
"{",
"v",
",",
"err",
":=",
"opt",
".",
"validato... | // Set validates a WeightDevice and sets its name as a key in WeightdeviceOpt | [
"Set",
"validates",
"a",
"WeightDevice",
"and",
"sets",
"its",
"name",
"as",
"a",
"key",
"in",
"WeightdeviceOpt"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/opts/weightdevice.go#L53-L64 |
159,943 | docker/cli | cli/command/stack/swarm/remove.go | RunRemove | func RunRemove(dockerCli command.Cli, opts options.Remove) error {
client := dockerCli.Client()
ctx := context.Background()
var errs []string
for _, namespace := range opts.Namespaces {
services, err := getStackServices(ctx, client, namespace)
if err != nil {
return err
}
networks, err := getStackNetwo... | go | func RunRemove(dockerCli command.Cli, opts options.Remove) error {
client := dockerCli.Client()
ctx := context.Background()
var errs []string
for _, namespace := range opts.Namespaces {
services, err := getStackServices(ctx, client, namespace)
if err != nil {
return err
}
networks, err := getStackNetwo... | [
"func",
"RunRemove",
"(",
"dockerCli",
"command",
".",
"Cli",
",",
"opts",
"options",
".",
"Remove",
")",
"error",
"{",
"client",
":=",
"dockerCli",
".",
"Client",
"(",
")",
"\n",
"ctx",
":=",
"context",
".",
"Background",
"(",
")",
"\n\n",
"var",
"err... | // RunRemove is the swarm implementation of docker stack remove | [
"RunRemove",
"is",
"the",
"swarm",
"implementation",
"of",
"docker",
"stack",
"remove"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/stack/swarm/remove.go#L18-L69 |
159,944 | docker/cli | cli/manifest/store/store.go | Remove | func (s *fsStore) Remove(listRef reference.Reference) error {
path := filepath.Join(s.root, makeFilesafeName(listRef.String()))
return os.RemoveAll(path)
} | go | func (s *fsStore) Remove(listRef reference.Reference) error {
path := filepath.Join(s.root, makeFilesafeName(listRef.String()))
return os.RemoveAll(path)
} | [
"func",
"(",
"s",
"*",
"fsStore",
")",
"Remove",
"(",
"listRef",
"reference",
".",
"Reference",
")",
"error",
"{",
"path",
":=",
"filepath",
".",
"Join",
"(",
"s",
".",
"root",
",",
"makeFilesafeName",
"(",
"listRef",
".",
"String",
"(",
")",
")",
")... | // Remove a manifest list from local storage | [
"Remove",
"a",
"manifest",
"list",
"from",
"local",
"storage"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/manifest/store/store.go#L38-L41 |
159,945 | docker/cli | cli/manifest/store/store.go | Get | func (s *fsStore) Get(listRef reference.Reference, manifest reference.Reference) (types.ImageManifest, error) {
filename := manifestToFilename(s.root, listRef.String(), manifest.String())
return s.getFromFilename(manifest, filename)
} | go | func (s *fsStore) Get(listRef reference.Reference, manifest reference.Reference) (types.ImageManifest, error) {
filename := manifestToFilename(s.root, listRef.String(), manifest.String())
return s.getFromFilename(manifest, filename)
} | [
"func",
"(",
"s",
"*",
"fsStore",
")",
"Get",
"(",
"listRef",
"reference",
".",
"Reference",
",",
"manifest",
"reference",
".",
"Reference",
")",
"(",
"types",
".",
"ImageManifest",
",",
"error",
")",
"{",
"filename",
":=",
"manifestToFilename",
"(",
"s",
... | // Get returns the local manifest | [
"Get",
"returns",
"the",
"local",
"manifest"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/manifest/store/store.go#L44-L47 |
159,946 | docker/cli | cli/manifest/store/store.go | GetList | func (s *fsStore) GetList(listRef reference.Reference) ([]types.ImageManifest, error) {
filenames, err := s.listManifests(listRef.String())
switch {
case err != nil:
return nil, err
case filenames == nil:
return nil, newNotFoundError(listRef.String())
}
manifests := []types.ImageManifest{}
for _, filename :... | go | func (s *fsStore) GetList(listRef reference.Reference) ([]types.ImageManifest, error) {
filenames, err := s.listManifests(listRef.String())
switch {
case err != nil:
return nil, err
case filenames == nil:
return nil, newNotFoundError(listRef.String())
}
manifests := []types.ImageManifest{}
for _, filename :... | [
"func",
"(",
"s",
"*",
"fsStore",
")",
"GetList",
"(",
"listRef",
"reference",
".",
"Reference",
")",
"(",
"[",
"]",
"types",
".",
"ImageManifest",
",",
"error",
")",
"{",
"filenames",
",",
"err",
":=",
"s",
".",
"listManifests",
"(",
"listRef",
".",
... | // GetList returns all the local manifests for a transaction | [
"GetList",
"returns",
"all",
"the",
"local",
"manifests",
"for",
"a",
"transaction"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/manifest/store/store.go#L91-L110 |
159,947 | docker/cli | cli/manifest/store/store.go | listManifests | func (s *fsStore) listManifests(transaction string) ([]string, error) {
transactionDir := filepath.Join(s.root, makeFilesafeName(transaction))
fileInfos, err := ioutil.ReadDir(transactionDir)
switch {
case os.IsNotExist(err):
return nil, nil
case err != nil:
return nil, err
}
filenames := []string{}
for _,... | go | func (s *fsStore) listManifests(transaction string) ([]string, error) {
transactionDir := filepath.Join(s.root, makeFilesafeName(transaction))
fileInfos, err := ioutil.ReadDir(transactionDir)
switch {
case os.IsNotExist(err):
return nil, nil
case err != nil:
return nil, err
}
filenames := []string{}
for _,... | [
"func",
"(",
"s",
"*",
"fsStore",
")",
"listManifests",
"(",
"transaction",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"transactionDir",
":=",
"filepath",
".",
"Join",
"(",
"s",
".",
"root",
",",
"makeFilesafeName",
"(",
"transaction... | // listManifests stored in a transaction | [
"listManifests",
"stored",
"in",
"a",
"transaction"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/manifest/store/store.go#L113-L128 |
159,948 | docker/cli | cli/manifest/store/store.go | Save | func (s *fsStore) Save(listRef reference.Reference, manifest reference.Reference, image types.ImageManifest) error {
if err := s.createManifestListDirectory(listRef.String()); err != nil {
return err
}
filename := manifestToFilename(s.root, listRef.String(), manifest.String())
bytes, err := json.Marshal(image)
i... | go | func (s *fsStore) Save(listRef reference.Reference, manifest reference.Reference, image types.ImageManifest) error {
if err := s.createManifestListDirectory(listRef.String()); err != nil {
return err
}
filename := manifestToFilename(s.root, listRef.String(), manifest.String())
bytes, err := json.Marshal(image)
i... | [
"func",
"(",
"s",
"*",
"fsStore",
")",
"Save",
"(",
"listRef",
"reference",
".",
"Reference",
",",
"manifest",
"reference",
".",
"Reference",
",",
"image",
"types",
".",
"ImageManifest",
")",
"error",
"{",
"if",
"err",
":=",
"s",
".",
"createManifestListDi... | // Save a manifest as part of a local manifest list | [
"Save",
"a",
"manifest",
"as",
"part",
"of",
"a",
"local",
"manifest",
"list"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/manifest/store/store.go#L131-L141 |
159,949 | docker/cli | cli/connhelper/commandconn/commandconn.go | New | func New(ctx context.Context, cmd string, args ...string) (net.Conn, error) {
var (
c commandConn
err error
)
c.cmd = exec.CommandContext(ctx, cmd, args...)
// we assume that args never contains sensitive information
logrus.Debugf("commandconn: starting %s with %v", cmd, args)
c.cmd.Env = os.Environ()
c.cm... | go | func New(ctx context.Context, cmd string, args ...string) (net.Conn, error) {
var (
c commandConn
err error
)
c.cmd = exec.CommandContext(ctx, cmd, args...)
// we assume that args never contains sensitive information
logrus.Debugf("commandconn: starting %s with %v", cmd, args)
c.cmd.Env = os.Environ()
c.cm... | [
"func",
"New",
"(",
"ctx",
"context",
".",
"Context",
",",
"cmd",
"string",
",",
"args",
"...",
"string",
")",
"(",
"net",
".",
"Conn",
",",
"error",
")",
"{",
"var",
"(",
"c",
"commandConn",
"\n",
"err",
"error",
"\n",
")",
"\n",
"c",
".",
"cmd"... | // New returns net.Conn | [
"New",
"returns",
"net",
".",
"Conn"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/connhelper/commandconn/commandconn.go#L35-L63 |
159,950 | docker/cli | cli/connhelper/commandconn/commandconn.go | killIfStdioClosed | func (c *commandConn) killIfStdioClosed() error {
c.stdioClosedMu.Lock()
stdioClosed := c.stdoutClosed && c.stdinClosed
c.stdioClosedMu.Unlock()
if !stdioClosed {
return nil
}
return c.kill()
} | go | func (c *commandConn) killIfStdioClosed() error {
c.stdioClosedMu.Lock()
stdioClosed := c.stdoutClosed && c.stdinClosed
c.stdioClosedMu.Unlock()
if !stdioClosed {
return nil
}
return c.kill()
} | [
"func",
"(",
"c",
"*",
"commandConn",
")",
"killIfStdioClosed",
"(",
")",
"error",
"{",
"c",
".",
"stdioClosedMu",
".",
"Lock",
"(",
")",
"\n",
"stdioClosed",
":=",
"c",
".",
"stdoutClosed",
"&&",
"c",
".",
"stdinClosed",
"\n",
"c",
".",
"stdioClosedMu",... | // killIfStdioClosed kills the cmd if both stdin and stdout are closed. | [
"killIfStdioClosed",
"kills",
"the",
"cmd",
"if",
"both",
"stdin",
"and",
"stdout",
"are",
"closed",
"."
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/connhelper/commandconn/commandconn.go#L83-L91 |
159,951 | docker/cli | cli/connhelper/commandconn/commandconn.go | killAndWait | func killAndWait(cmd *exec.Cmd) error {
var werr error
if runtime.GOOS != "windows" {
werrCh := make(chan error)
go func() { werrCh <- cmd.Wait() }()
cmd.Process.Signal(syscall.SIGTERM)
select {
case werr = <-werrCh:
case <-time.After(3 * time.Second):
cmd.Process.Kill()
werr = <-werrCh
}
} else ... | go | func killAndWait(cmd *exec.Cmd) error {
var werr error
if runtime.GOOS != "windows" {
werrCh := make(chan error)
go func() { werrCh <- cmd.Wait() }()
cmd.Process.Signal(syscall.SIGTERM)
select {
case werr = <-werrCh:
case <-time.After(3 * time.Second):
cmd.Process.Kill()
werr = <-werrCh
}
} else ... | [
"func",
"killAndWait",
"(",
"cmd",
"*",
"exec",
".",
"Cmd",
")",
"error",
"{",
"var",
"werr",
"error",
"\n",
"if",
"runtime",
".",
"GOOS",
"!=",
"\"",
"\"",
"{",
"werrCh",
":=",
"make",
"(",
"chan",
"error",
")",
"\n",
"go",
"func",
"(",
")",
"{"... | // killAndWait tries sending SIGTERM to the process before sending SIGKILL. | [
"killAndWait",
"tries",
"sending",
"SIGTERM",
"to",
"the",
"process",
"before",
"sending",
"SIGKILL",
"."
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/connhelper/commandconn/commandconn.go#L94-L111 |
159,952 | docker/cli | cli/connhelper/commandconn/commandconn.go | kill | func (c *commandConn) kill() error {
var werr error
c.cmdMutex.Lock()
if c.cmdExited {
werr = c.cmdWaitErr
} else {
werr = killAndWait(c.cmd)
c.cmdWaitErr = werr
c.cmdExited = true
}
c.cmdMutex.Unlock()
if werr == nil {
return nil
}
wExitErr, ok := werr.(*exec.ExitError)
if ok {
if wExitErr.Proces... | go | func (c *commandConn) kill() error {
var werr error
c.cmdMutex.Lock()
if c.cmdExited {
werr = c.cmdWaitErr
} else {
werr = killAndWait(c.cmd)
c.cmdWaitErr = werr
c.cmdExited = true
}
c.cmdMutex.Unlock()
if werr == nil {
return nil
}
wExitErr, ok := werr.(*exec.ExitError)
if ok {
if wExitErr.Proces... | [
"func",
"(",
"c",
"*",
"commandConn",
")",
"kill",
"(",
")",
"error",
"{",
"var",
"werr",
"error",
"\n",
"c",
".",
"cmdMutex",
".",
"Lock",
"(",
")",
"\n",
"if",
"c",
".",
"cmdExited",
"{",
"werr",
"=",
"c",
".",
"cmdWaitErr",
"\n",
"}",
"else",
... | // kill returns nil if the command terminated, regardless to the exit status. | [
"kill",
"returns",
"nil",
"if",
"the",
"command",
"terminated",
"regardless",
"to",
"the",
"exit",
"status",
"."
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/connhelper/commandconn/commandconn.go#L114-L135 |
159,953 | docker/cli | cli/command/manifest/util.go | getManifest | func getManifest(ctx context.Context, dockerCli command.Cli, listRef, namedRef reference.Named, insecure bool) (types.ImageManifest, error) {
data, err := dockerCli.ManifestStore().Get(listRef, namedRef)
switch {
case store.IsNotFound(err):
return dockerCli.RegistryClient(insecure).GetManifest(ctx, namedRef)
case... | go | func getManifest(ctx context.Context, dockerCli command.Cli, listRef, namedRef reference.Named, insecure bool) (types.ImageManifest, error) {
data, err := dockerCli.ManifestStore().Get(listRef, namedRef)
switch {
case store.IsNotFound(err):
return dockerCli.RegistryClient(insecure).GetManifest(ctx, namedRef)
case... | [
"func",
"getManifest",
"(",
"ctx",
"context",
".",
"Context",
",",
"dockerCli",
"command",
".",
"Cli",
",",
"listRef",
",",
"namedRef",
"reference",
".",
"Named",
",",
"insecure",
"bool",
")",
"(",
"types",
".",
"ImageManifest",
",",
"error",
")",
"{",
"... | // getManifest from the local store, and fallback to the remote registry if it
// doesn't exist locally | [
"getManifest",
"from",
"the",
"local",
"store",
"and",
"fallback",
"to",
"the",
"remote",
"registry",
"if",
"it",
"doesn",
"t",
"exist",
"locally"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/manifest/util.go#L71-L81 |
159,954 | docker/cli | cli/command/network/formatter.go | NewFormat | func NewFormat(source string, quiet bool) formatter.Format {
switch source {
case formatter.TableFormatKey:
if quiet {
return formatter.DefaultQuietFormat
}
return defaultNetworkTableFormat
case formatter.RawFormatKey:
if quiet {
return `network_id: {{.ID}}`
}
return `network_id: {{.ID}}\nname: {{.... | go | func NewFormat(source string, quiet bool) formatter.Format {
switch source {
case formatter.TableFormatKey:
if quiet {
return formatter.DefaultQuietFormat
}
return defaultNetworkTableFormat
case formatter.RawFormatKey:
if quiet {
return `network_id: {{.ID}}`
}
return `network_id: {{.ID}}\nname: {{.... | [
"func",
"NewFormat",
"(",
"source",
"string",
",",
"quiet",
"bool",
")",
"formatter",
".",
"Format",
"{",
"switch",
"source",
"{",
"case",
"formatter",
".",
"TableFormatKey",
":",
"if",
"quiet",
"{",
"return",
"formatter",
".",
"DefaultQuietFormat",
"\n",
"}... | // NewFormat returns a Format for rendering using a network Context | [
"NewFormat",
"returns",
"a",
"Format",
"for",
"rendering",
"using",
"a",
"network",
"Context"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/network/formatter.go#L21-L35 |
159,955 | docker/cli | cli/command/stack/kubernetes/convert.go | stackFromV1beta1 | func stackFromV1beta1(in *v1beta1.Stack) (Stack, error) {
cfg, err := loadStackData(in.Spec.ComposeFile)
if err != nil {
return Stack{}, err
}
spec, err := fromComposeConfig(ioutil.Discard, cfg, v1beta1Capabilities)
if err != nil {
return Stack{}, err
}
return Stack{
Name: in.ObjectMeta.Name,
Name... | go | func stackFromV1beta1(in *v1beta1.Stack) (Stack, error) {
cfg, err := loadStackData(in.Spec.ComposeFile)
if err != nil {
return Stack{}, err
}
spec, err := fromComposeConfig(ioutil.Discard, cfg, v1beta1Capabilities)
if err != nil {
return Stack{}, err
}
return Stack{
Name: in.ObjectMeta.Name,
Name... | [
"func",
"stackFromV1beta1",
"(",
"in",
"*",
"v1beta1",
".",
"Stack",
")",
"(",
"Stack",
",",
"error",
")",
"{",
"cfg",
",",
"err",
":=",
"loadStackData",
"(",
"in",
".",
"Spec",
".",
"ComposeFile",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
... | // Conversions from internal stack to different stack compose component versions. | [
"Conversions",
"from",
"internal",
"stack",
"to",
"different",
"stack",
"compose",
"component",
"versions",
"."
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/stack/kubernetes/convert.go#L113-L128 |
159,956 | docker/cli | cli/command/container/formatter_diff.go | NewDiffFormat | func NewDiffFormat(source string) formatter.Format {
switch source {
case formatter.TableFormatKey:
return defaultDiffTableFormat
}
return formatter.Format(source)
} | go | func NewDiffFormat(source string) formatter.Format {
switch source {
case formatter.TableFormatKey:
return defaultDiffTableFormat
}
return formatter.Format(source)
} | [
"func",
"NewDiffFormat",
"(",
"source",
"string",
")",
"formatter",
".",
"Format",
"{",
"switch",
"source",
"{",
"case",
"formatter",
".",
"TableFormatKey",
":",
"return",
"defaultDiffTableFormat",
"\n",
"}",
"\n",
"return",
"formatter",
".",
"Format",
"(",
"s... | // NewDiffFormat returns a format for use with a diff Context | [
"NewDiffFormat",
"returns",
"a",
"format",
"for",
"use",
"with",
"a",
"diff",
"Context"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/container/formatter_diff.go#L17-L23 |
159,957 | docker/cli | cli/command/container/formatter_diff.go | DiffFormatWrite | func DiffFormatWrite(ctx formatter.Context, changes []container.ContainerChangeResponseItem) error {
render := func(format func(subContext formatter.SubContext) error) error {
for _, change := range changes {
if err := format(&diffContext{c: change}); err != nil {
return err
}
}
return nil
}
return ... | go | func DiffFormatWrite(ctx formatter.Context, changes []container.ContainerChangeResponseItem) error {
render := func(format func(subContext formatter.SubContext) error) error {
for _, change := range changes {
if err := format(&diffContext{c: change}); err != nil {
return err
}
}
return nil
}
return ... | [
"func",
"DiffFormatWrite",
"(",
"ctx",
"formatter",
".",
"Context",
",",
"changes",
"[",
"]",
"container",
".",
"ContainerChangeResponseItem",
")",
"error",
"{",
"render",
":=",
"func",
"(",
"format",
"func",
"(",
"subContext",
"formatter",
".",
"SubContext",
... | // DiffFormatWrite writes formatted diff using the Context | [
"DiffFormatWrite",
"writes",
"formatted",
"diff",
"using",
"the",
"Context"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/container/formatter_diff.go#L26-L37 |
159,958 | docker/cli | cli/command/trust/cmd.go | NewTrustCommand | func NewTrustCommand(dockerCli command.Cli) *cobra.Command {
cmd := &cobra.Command{
Use: "trust",
Short: "Manage trust on Docker images",
Args: cli.NoArgs,
RunE: command.ShowHelp(dockerCli.Err()),
}
cmd.AddCommand(
newRevokeCommand(dockerCli),
newSignCommand(dockerCli),
newTrustKeyCommand(dockerCli... | go | func NewTrustCommand(dockerCli command.Cli) *cobra.Command {
cmd := &cobra.Command{
Use: "trust",
Short: "Manage trust on Docker images",
Args: cli.NoArgs,
RunE: command.ShowHelp(dockerCli.Err()),
}
cmd.AddCommand(
newRevokeCommand(dockerCli),
newSignCommand(dockerCli),
newTrustKeyCommand(dockerCli... | [
"func",
"NewTrustCommand",
"(",
"dockerCli",
"command",
".",
"Cli",
")",
"*",
"cobra",
".",
"Command",
"{",
"cmd",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Args",
":",
"cli",
".",
"NoArgs... | // NewTrustCommand returns a cobra command for `trust` subcommands | [
"NewTrustCommand",
"returns",
"a",
"cobra",
"command",
"for",
"trust",
"subcommands"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/trust/cmd.go#L10-L25 |
159,959 | docker/cli | cli/command/plugin/cmd.go | NewPluginCommand | func NewPluginCommand(dockerCli command.Cli) *cobra.Command {
cmd := &cobra.Command{
Use: "plugin",
Short: "Manage plugins",
Args: cli.NoArgs,
RunE: command.ShowHelp(dockerCli.Err()),
Annotations: map[string]string{"version": "1.25"},
}
cmd.AddCommand(
newDisableCommand(docke... | go | func NewPluginCommand(dockerCli command.Cli) *cobra.Command {
cmd := &cobra.Command{
Use: "plugin",
Short: "Manage plugins",
Args: cli.NoArgs,
RunE: command.ShowHelp(dockerCli.Err()),
Annotations: map[string]string{"version": "1.25"},
}
cmd.AddCommand(
newDisableCommand(docke... | [
"func",
"NewPluginCommand",
"(",
"dockerCli",
"command",
".",
"Cli",
")",
"*",
"cobra",
".",
"Command",
"{",
"cmd",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Args",
":",
"cli",
".",
"NoArg... | // NewPluginCommand returns a cobra command for `plugin` subcommands | [
"NewPluginCommand",
"returns",
"a",
"cobra",
"command",
"for",
"plugin",
"subcommands"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/plugin/cmd.go#L10-L32 |
159,960 | docker/cli | cli/command/inspect/inspector.go | NewTemplateInspector | func NewTemplateInspector(outputStream io.Writer, tmpl *template.Template) Inspector {
return &TemplateInspector{
outputStream: outputStream,
buffer: new(bytes.Buffer),
tmpl: tmpl,
}
} | go | func NewTemplateInspector(outputStream io.Writer, tmpl *template.Template) Inspector {
return &TemplateInspector{
outputStream: outputStream,
buffer: new(bytes.Buffer),
tmpl: tmpl,
}
} | [
"func",
"NewTemplateInspector",
"(",
"outputStream",
"io",
".",
"Writer",
",",
"tmpl",
"*",
"template",
".",
"Template",
")",
"Inspector",
"{",
"return",
"&",
"TemplateInspector",
"{",
"outputStream",
":",
"outputStream",
",",
"buffer",
":",
"new",
"(",
"bytes... | // NewTemplateInspector creates a new inspector with a template. | [
"NewTemplateInspector",
"creates",
"a",
"new",
"inspector",
"with",
"a",
"template",
"."
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/inspect/inspector.go#L30-L36 |
159,961 | docker/cli | cli/command/inspect/inspector.go | NewTemplateInspectorFromString | func NewTemplateInspectorFromString(out io.Writer, tmplStr string) (Inspector, error) {
if tmplStr == "" {
return NewIndentedInspector(out), nil
}
tmpl, err := templates.Parse(tmplStr)
if err != nil {
return nil, errors.Errorf("Template parsing error: %s", err)
}
return NewTemplateInspector(out, tmpl), nil
} | go | func NewTemplateInspectorFromString(out io.Writer, tmplStr string) (Inspector, error) {
if tmplStr == "" {
return NewIndentedInspector(out), nil
}
tmpl, err := templates.Parse(tmplStr)
if err != nil {
return nil, errors.Errorf("Template parsing error: %s", err)
}
return NewTemplateInspector(out, tmpl), nil
} | [
"func",
"NewTemplateInspectorFromString",
"(",
"out",
"io",
".",
"Writer",
",",
"tmplStr",
"string",
")",
"(",
"Inspector",
",",
"error",
")",
"{",
"if",
"tmplStr",
"==",
"\"",
"\"",
"{",
"return",
"NewIndentedInspector",
"(",
"out",
")",
",",
"nil",
"\n",... | // NewTemplateInspectorFromString creates a new TemplateInspector from a string
// which is compiled into a template. | [
"NewTemplateInspectorFromString",
"creates",
"a",
"new",
"TemplateInspector",
"from",
"a",
"string",
"which",
"is",
"compiled",
"into",
"a",
"template",
"."
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/inspect/inspector.go#L40-L50 |
159,962 | docker/cli | cli/command/inspect/inspector.go | Inspect | func Inspect(out io.Writer, references []string, tmplStr string, getRef GetRefFunc) error {
inspector, err := NewTemplateInspectorFromString(out, tmplStr)
if err != nil {
return cli.StatusError{StatusCode: 64, Status: err.Error()}
}
var inspectErrs []string
for _, ref := range references {
element, raw, err :... | go | func Inspect(out io.Writer, references []string, tmplStr string, getRef GetRefFunc) error {
inspector, err := NewTemplateInspectorFromString(out, tmplStr)
if err != nil {
return cli.StatusError{StatusCode: 64, Status: err.Error()}
}
var inspectErrs []string
for _, ref := range references {
element, raw, err :... | [
"func",
"Inspect",
"(",
"out",
"io",
".",
"Writer",
",",
"references",
"[",
"]",
"string",
",",
"tmplStr",
"string",
",",
"getRef",
"GetRefFunc",
")",
"error",
"{",
"inspector",
",",
"err",
":=",
"NewTemplateInspectorFromString",
"(",
"out",
",",
"tmplStr",
... | // Inspect fetches objects by reference using GetRefFunc and writes the json
// representation to the output writer. | [
"Inspect",
"fetches",
"objects",
"by",
"reference",
"using",
"GetRefFunc",
"and",
"writes",
"the",
"json",
"representation",
"to",
"the",
"output",
"writer",
"."
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/inspect/inspector.go#L58-L88 |
159,963 | docker/cli | cli/command/inspect/inspector.go | Inspect | func (i *TemplateInspector) Inspect(typedElement interface{}, rawElement []byte) error {
buffer := new(bytes.Buffer)
if err := i.tmpl.Execute(buffer, typedElement); err != nil {
if rawElement == nil {
return errors.Errorf("Template parsing error: %v", err)
}
return i.tryRawInspectFallback(rawElement)
}
i.b... | go | func (i *TemplateInspector) Inspect(typedElement interface{}, rawElement []byte) error {
buffer := new(bytes.Buffer)
if err := i.tmpl.Execute(buffer, typedElement); err != nil {
if rawElement == nil {
return errors.Errorf("Template parsing error: %v", err)
}
return i.tryRawInspectFallback(rawElement)
}
i.b... | [
"func",
"(",
"i",
"*",
"TemplateInspector",
")",
"Inspect",
"(",
"typedElement",
"interface",
"{",
"}",
",",
"rawElement",
"[",
"]",
"byte",
")",
"error",
"{",
"buffer",
":=",
"new",
"(",
"bytes",
".",
"Buffer",
")",
"\n",
"if",
"err",
":=",
"i",
"."... | // Inspect executes the inspect template.
// It decodes the raw element into a map if the initial execution fails.
// This allows docker cli to parse inspect structs injected with Swarm fields. | [
"Inspect",
"executes",
"the",
"inspect",
"template",
".",
"It",
"decodes",
"the",
"raw",
"element",
"into",
"a",
"map",
"if",
"the",
"initial",
"execution",
"fails",
".",
"This",
"allows",
"docker",
"cli",
"to",
"parse",
"inspect",
"structs",
"injected",
"wi... | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/inspect/inspector.go#L93-L104 |
159,964 | docker/cli | cli/command/inspect/inspector.go | tryRawInspectFallback | func (i *TemplateInspector) tryRawInspectFallback(rawElement []byte) error {
var raw interface{}
buffer := new(bytes.Buffer)
rdr := bytes.NewReader(rawElement)
dec := json.NewDecoder(rdr)
dec.UseNumber()
if rawErr := dec.Decode(&raw); rawErr != nil {
return errors.Errorf("unable to read inspect data: %v", rawE... | go | func (i *TemplateInspector) tryRawInspectFallback(rawElement []byte) error {
var raw interface{}
buffer := new(bytes.Buffer)
rdr := bytes.NewReader(rawElement)
dec := json.NewDecoder(rdr)
dec.UseNumber()
if rawErr := dec.Decode(&raw); rawErr != nil {
return errors.Errorf("unable to read inspect data: %v", rawE... | [
"func",
"(",
"i",
"*",
"TemplateInspector",
")",
"tryRawInspectFallback",
"(",
"rawElement",
"[",
"]",
"byte",
")",
"error",
"{",
"var",
"raw",
"interface",
"{",
"}",
"\n",
"buffer",
":=",
"new",
"(",
"bytes",
".",
"Buffer",
")",
"\n",
"rdr",
":=",
"by... | // tryRawInspectFallback executes the inspect template with a raw interface.
// This allows docker cli to parse inspect structs injected with Swarm fields. | [
"tryRawInspectFallback",
"executes",
"the",
"inspect",
"template",
"with",
"a",
"raw",
"interface",
".",
"This",
"allows",
"docker",
"cli",
"to",
"parse",
"inspect",
"structs",
"injected",
"with",
"Swarm",
"fields",
"."
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/inspect/inspector.go#L108-L127 |
159,965 | docker/cli | cli/command/inspect/inspector.go | Inspect | func (i *IndentedInspector) Inspect(typedElement interface{}, rawElement []byte) error {
if rawElement != nil {
i.rawElements = append(i.rawElements, rawElement)
} else {
i.elements = append(i.elements, typedElement)
}
return nil
} | go | func (i *IndentedInspector) Inspect(typedElement interface{}, rawElement []byte) error {
if rawElement != nil {
i.rawElements = append(i.rawElements, rawElement)
} else {
i.elements = append(i.elements, typedElement)
}
return nil
} | [
"func",
"(",
"i",
"*",
"IndentedInspector",
")",
"Inspect",
"(",
"typedElement",
"interface",
"{",
"}",
",",
"rawElement",
"[",
"]",
"byte",
")",
"error",
"{",
"if",
"rawElement",
"!=",
"nil",
"{",
"i",
".",
"rawElements",
"=",
"append",
"(",
"i",
".",... | // Inspect writes the raw element with an indented json format. | [
"Inspect",
"writes",
"the",
"raw",
"element",
"with",
"an",
"indented",
"json",
"format",
"."
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/inspect/inspector.go#L154-L161 |
159,966 | docker/cli | cli/command/idresolver/idresolver.go | New | func New(client client.APIClient, noResolve bool) *IDResolver {
return &IDResolver{
client: client,
noResolve: noResolve,
cache: make(map[string]string),
}
} | go | func New(client client.APIClient, noResolve bool) *IDResolver {
return &IDResolver{
client: client,
noResolve: noResolve,
cache: make(map[string]string),
}
} | [
"func",
"New",
"(",
"client",
"client",
".",
"APIClient",
",",
"noResolve",
"bool",
")",
"*",
"IDResolver",
"{",
"return",
"&",
"IDResolver",
"{",
"client",
":",
"client",
",",
"noResolve",
":",
"noResolve",
",",
"cache",
":",
"make",
"(",
"map",
"[",
... | // New creates a new IDResolver. | [
"New",
"creates",
"a",
"new",
"IDResolver",
"."
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/idresolver/idresolver.go#L20-L26 |
159,967 | docker/cli | cli/compose/loader/volume.go | ParseVolume | func ParseVolume(spec string) (types.ServiceVolumeConfig, error) {
volume := types.ServiceVolumeConfig{}
switch len(spec) {
case 0:
return volume, errors.New("invalid empty volume spec")
case 1, 2:
volume.Target = spec
volume.Type = string(mount.TypeVolume)
return volume, nil
}
buffer := []rune{}
for _... | go | func ParseVolume(spec string) (types.ServiceVolumeConfig, error) {
volume := types.ServiceVolumeConfig{}
switch len(spec) {
case 0:
return volume, errors.New("invalid empty volume spec")
case 1, 2:
volume.Target = spec
volume.Type = string(mount.TypeVolume)
return volume, nil
}
buffer := []rune{}
for _... | [
"func",
"ParseVolume",
"(",
"spec",
"string",
")",
"(",
"types",
".",
"ServiceVolumeConfig",
",",
"error",
")",
"{",
"volume",
":=",
"types",
".",
"ServiceVolumeConfig",
"{",
"}",
"\n\n",
"switch",
"len",
"(",
"spec",
")",
"{",
"case",
"0",
":",
"return"... | // ParseVolume parses a volume spec without any knowledge of the target platform | [
"ParseVolume",
"parses",
"a",
"volume",
"spec",
"without",
"any",
"knowledge",
"of",
"the",
"target",
"platform"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/compose/loader/volume.go#L16-L46 |
159,968 | docker/cli | cli/command/system/dial_stdio.go | newDialStdioCommand | func newDialStdioCommand(dockerCli command.Cli) *cobra.Command {
cmd := &cobra.Command{
Use: "dial-stdio",
Short: "Proxy the stdio stream to the daemon connection. Should not be invoked manually.",
Args: cli.NoArgs,
Hidden: true,
RunE: func(cmd *cobra.Command, args []string) error {
return runDialSt... | go | func newDialStdioCommand(dockerCli command.Cli) *cobra.Command {
cmd := &cobra.Command{
Use: "dial-stdio",
Short: "Proxy the stdio stream to the daemon connection. Should not be invoked manually.",
Args: cli.NoArgs,
Hidden: true,
RunE: func(cmd *cobra.Command, args []string) error {
return runDialSt... | [
"func",
"newDialStdioCommand",
"(",
"dockerCli",
"command",
".",
"Cli",
")",
"*",
"cobra",
".",
"Command",
"{",
"cmd",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Args",
":",
"cli",
".",
"No... | // newDialStdioCommand creates a new cobra.Command for `docker system dial-stdio` | [
"newDialStdioCommand",
"creates",
"a",
"new",
"cobra",
".",
"Command",
"for",
"docker",
"system",
"dial",
"-",
"stdio"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/system/dial_stdio.go#L16-L27 |
159,969 | docker/cli | cli/command/container/unpause.go | NewUnpauseCommand | func NewUnpauseCommand(dockerCli command.Cli) *cobra.Command {
var opts unpauseOptions
cmd := &cobra.Command{
Use: "unpause CONTAINER [CONTAINER...]",
Short: "Unpause all processes within one or more containers",
Args: cli.RequiresMinArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
opts.c... | go | func NewUnpauseCommand(dockerCli command.Cli) *cobra.Command {
var opts unpauseOptions
cmd := &cobra.Command{
Use: "unpause CONTAINER [CONTAINER...]",
Short: "Unpause all processes within one or more containers",
Args: cli.RequiresMinArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
opts.c... | [
"func",
"NewUnpauseCommand",
"(",
"dockerCli",
"command",
".",
"Cli",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"opts",
"unpauseOptions",
"\n\n",
"cmd",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\""... | // NewUnpauseCommand creates a new cobra.Command for `docker unpause` | [
"NewUnpauseCommand",
"creates",
"a",
"new",
"cobra",
".",
"Command",
"for",
"docker",
"unpause"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/container/unpause.go#L19-L32 |
159,970 | docker/cli | cli/command/config/cmd.go | NewConfigCommand | func NewConfigCommand(dockerCli command.Cli) *cobra.Command {
cmd := &cobra.Command{
Use: "config",
Short: "Manage Docker configs",
Args: cli.NoArgs,
RunE: command.ShowHelp(dockerCli.Err()),
Annotations: map[string]string{
"version": "1.30",
"swarm": "",
},
}
cmd.AddCommand(
newConfigListCo... | go | func NewConfigCommand(dockerCli command.Cli) *cobra.Command {
cmd := &cobra.Command{
Use: "config",
Short: "Manage Docker configs",
Args: cli.NoArgs,
RunE: command.ShowHelp(dockerCli.Err()),
Annotations: map[string]string{
"version": "1.30",
"swarm": "",
},
}
cmd.AddCommand(
newConfigListCo... | [
"func",
"NewConfigCommand",
"(",
"dockerCli",
"command",
".",
"Cli",
")",
"*",
"cobra",
".",
"Command",
"{",
"cmd",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Args",
":",
"cli",
".",
"NoArg... | // NewConfigCommand returns a cobra command for `config` subcommands | [
"NewConfigCommand",
"returns",
"a",
"cobra",
"command",
"for",
"config",
"subcommands"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/config/cmd.go#L11-L29 |
159,971 | docker/cli | kubernetes/check.go | GetStackAPIVersion | func GetStackAPIVersion(serverGroups discovery.ServerGroupsInterface, experimental bool) (StackVersion, error) {
groups, err := serverGroups.ServerGroups()
if err != nil {
return "", err
}
return getAPIVersion(groups, experimental)
} | go | func GetStackAPIVersion(serverGroups discovery.ServerGroupsInterface, experimental bool) (StackVersion, error) {
groups, err := serverGroups.ServerGroups()
if err != nil {
return "", err
}
return getAPIVersion(groups, experimental)
} | [
"func",
"GetStackAPIVersion",
"(",
"serverGroups",
"discovery",
".",
"ServerGroupsInterface",
",",
"experimental",
"bool",
")",
"(",
"StackVersion",
",",
"error",
")",
"{",
"groups",
",",
"err",
":=",
"serverGroups",
".",
"ServerGroups",
"(",
")",
"\n",
"if",
... | // GetStackAPIVersion returns the most appropriate stack API version installed. | [
"GetStackAPIVersion",
"returns",
"the",
"most",
"appropriate",
"stack",
"API",
"version",
"installed",
"."
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/kubernetes/check.go#L27-L34 |
159,972 | docker/cli | cli/command/stack/swarm/services.go | RunServices | func RunServices(dockerCli command.Cli, opts options.Services) error {
ctx := context.Background()
client := dockerCli.Client()
filter := getStackFilterFromOpt(opts.Namespace, opts.Filter)
services, err := client.ServiceList(ctx, types.ServiceListOptions{Filters: filter})
if err != nil {
return err
}
// if n... | go | func RunServices(dockerCli command.Cli, opts options.Services) error {
ctx := context.Background()
client := dockerCli.Client()
filter := getStackFilterFromOpt(opts.Namespace, opts.Filter)
services, err := client.ServiceList(ctx, types.ServiceListOptions{Filters: filter})
if err != nil {
return err
}
// if n... | [
"func",
"RunServices",
"(",
"dockerCli",
"command",
".",
"Cli",
",",
"opts",
"options",
".",
"Services",
")",
"error",
"{",
"ctx",
":=",
"context",
".",
"Background",
"(",
")",
"\n",
"client",
":=",
"dockerCli",
".",
"Client",
"(",
")",
"\n\n",
"filter",... | // RunServices is the swarm implementation of docker stack services | [
"RunServices",
"is",
"the",
"swarm",
"implementation",
"of",
"docker",
"stack",
"services"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/stack/swarm/services.go#L16-L66 |
159,973 | docker/cli | cli/command/context/export.go | RunExport | func RunExport(dockerCli command.Cli, opts *ExportOptions) error {
if err := validateContextName(opts.ContextName); err != nil && opts.ContextName != command.DefaultContextName {
return err
}
ctxMeta, err := dockerCli.ContextStore().GetMetadata(opts.ContextName)
if err != nil {
return err
}
if !opts.Kubeconfi... | go | func RunExport(dockerCli command.Cli, opts *ExportOptions) error {
if err := validateContextName(opts.ContextName); err != nil && opts.ContextName != command.DefaultContextName {
return err
}
ctxMeta, err := dockerCli.ContextStore().GetMetadata(opts.ContextName)
if err != nil {
return err
}
if !opts.Kubeconfi... | [
"func",
"RunExport",
"(",
"dockerCli",
"command",
".",
"Cli",
",",
"opts",
"*",
"ExportOptions",
")",
"error",
"{",
"if",
"err",
":=",
"validateContextName",
"(",
"opts",
".",
"ContextName",
")",
";",
"err",
"!=",
"nil",
"&&",
"opts",
".",
"ContextName",
... | // RunExport exports a Docker context | [
"RunExport",
"exports",
"a",
"Docker",
"context"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/context/export.go#L79-L110 |
159,974 | docker/cli | cli/command/service/helpers.go | waitOnService | func waitOnService(ctx context.Context, dockerCli command.Cli, serviceID string, quiet bool) error {
errChan := make(chan error, 1)
pipeReader, pipeWriter := io.Pipe()
go func() {
errChan <- progress.ServiceProgress(ctx, dockerCli.Client(), serviceID, pipeWriter)
}()
if quiet {
go io.Copy(ioutil.Discard, pip... | go | func waitOnService(ctx context.Context, dockerCli command.Cli, serviceID string, quiet bool) error {
errChan := make(chan error, 1)
pipeReader, pipeWriter := io.Pipe()
go func() {
errChan <- progress.ServiceProgress(ctx, dockerCli.Client(), serviceID, pipeWriter)
}()
if quiet {
go io.Copy(ioutil.Discard, pip... | [
"func",
"waitOnService",
"(",
"ctx",
"context",
".",
"Context",
",",
"dockerCli",
"command",
".",
"Cli",
",",
"serviceID",
"string",
",",
"quiet",
"bool",
")",
"error",
"{",
"errChan",
":=",
"make",
"(",
"chan",
"error",
",",
"1",
")",
"\n",
"pipeReader"... | // waitOnService waits for the service to converge. It outputs a progress bar,
// if appropriate based on the CLI flags. | [
"waitOnService",
"waits",
"for",
"the",
"service",
"to",
"converge",
".",
"It",
"outputs",
"a",
"progress",
"bar",
"if",
"appropriate",
"based",
"on",
"the",
"CLI",
"flags",
"."
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/service/helpers.go#L15-L33 |
159,975 | docker/cli | cli/command/image/import.go | NewImportCommand | func NewImportCommand(dockerCli command.Cli) *cobra.Command {
var options importOptions
cmd := &cobra.Command{
Use: "import [OPTIONS] file|URL|- [REPOSITORY[:TAG]]",
Short: "Import the contents from a tarball to create a filesystem image",
Args: cli.RequiresMinArgs(1),
RunE: func(cmd *cobra.Command, args ... | go | func NewImportCommand(dockerCli command.Cli) *cobra.Command {
var options importOptions
cmd := &cobra.Command{
Use: "import [OPTIONS] file|URL|- [REPOSITORY[:TAG]]",
Short: "Import the contents from a tarball to create a filesystem image",
Args: cli.RequiresMinArgs(1),
RunE: func(cmd *cobra.Command, args ... | [
"func",
"NewImportCommand",
"(",
"dockerCli",
"command",
".",
"Cli",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"options",
"importOptions",
"\n\n",
"cmd",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"... | // NewImportCommand creates a new `docker import` command | [
"NewImportCommand",
"creates",
"a",
"new",
"docker",
"import",
"command"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/image/import.go#L26-L50 |
159,976 | docker/cli | cli/command/image/push.go | NewPushCommand | func NewPushCommand(dockerCli command.Cli) *cobra.Command {
var opts pushOptions
cmd := &cobra.Command{
Use: "push [OPTIONS] NAME[:TAG]",
Short: "Push an image or a repository to a registry",
Args: cli.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
opts.remote = args[0]
return R... | go | func NewPushCommand(dockerCli command.Cli) *cobra.Command {
var opts pushOptions
cmd := &cobra.Command{
Use: "push [OPTIONS] NAME[:TAG]",
Short: "Push an image or a repository to a registry",
Args: cli.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
opts.remote = args[0]
return R... | [
"func",
"NewPushCommand",
"(",
"dockerCli",
"command",
".",
"Cli",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"opts",
"pushOptions",
"\n\n",
"cmd",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",... | // NewPushCommand creates a new `docker push` command | [
"NewPushCommand",
"creates",
"a",
"new",
"docker",
"push",
"command"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/image/push.go#L20-L38 |
159,977 | docker/cli | cli/command/image/push.go | RunPush | func RunPush(dockerCli command.Cli, opts pushOptions) error {
ref, err := reference.ParseNormalizedNamed(opts.remote)
if err != nil {
return err
}
// Resolve the Repository name from fqn to RepositoryInfo
repoInfo, err := registry.ParseRepositoryInfo(ref)
if err != nil {
return err
}
ctx := context.Backgr... | go | func RunPush(dockerCli command.Cli, opts pushOptions) error {
ref, err := reference.ParseNormalizedNamed(opts.remote)
if err != nil {
return err
}
// Resolve the Repository name from fqn to RepositoryInfo
repoInfo, err := registry.ParseRepositoryInfo(ref)
if err != nil {
return err
}
ctx := context.Backgr... | [
"func",
"RunPush",
"(",
"dockerCli",
"command",
".",
"Cli",
",",
"opts",
"pushOptions",
")",
"error",
"{",
"ref",
",",
"err",
":=",
"reference",
".",
"ParseNormalizedNamed",
"(",
"opts",
".",
"remote",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
... | // RunPush performs a push against the engine based on the specified options | [
"RunPush",
"performs",
"a",
"push",
"against",
"the",
"engine",
"based",
"on",
"the",
"specified",
"options"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/image/push.go#L41-L70 |
159,978 | docker/cli | opts/parse.go | ReadKVStrings | func ReadKVStrings(files []string, override []string) ([]string, error) {
return readKVStrings(files, override, nil)
} | go | func ReadKVStrings(files []string, override []string) ([]string, error) {
return readKVStrings(files, override, nil)
} | [
"func",
"ReadKVStrings",
"(",
"files",
"[",
"]",
"string",
",",
"override",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"return",
"readKVStrings",
"(",
"files",
",",
"override",
",",
"nil",
")",
"\n",
"}"
] | // ReadKVStrings reads a file of line terminated key=value pairs, and overrides any keys
// present in the file with additional pairs specified in the override parameter | [
"ReadKVStrings",
"reads",
"a",
"file",
"of",
"line",
"terminated",
"key",
"=",
"value",
"pairs",
"and",
"overrides",
"any",
"keys",
"present",
"in",
"the",
"file",
"with",
"additional",
"pairs",
"specified",
"in",
"the",
"override",
"parameter"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/opts/parse.go#L14-L16 |
159,979 | docker/cli | opts/parse.go | ReadKVEnvStrings | func ReadKVEnvStrings(files []string, override []string) ([]string, error) {
return readKVStrings(files, override, os.LookupEnv)
} | go | func ReadKVEnvStrings(files []string, override []string) ([]string, error) {
return readKVStrings(files, override, os.LookupEnv)
} | [
"func",
"ReadKVEnvStrings",
"(",
"files",
"[",
"]",
"string",
",",
"override",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"return",
"readKVStrings",
"(",
"files",
",",
"override",
",",
"os",
".",
"LookupEnv",
")",
"\n",
... | // ReadKVEnvStrings reads a file of line terminated key=value pairs, and overrides any keys
// present in the file with additional pairs specified in the override parameter.
// If a key has no value, it will get the value from the environment. | [
"ReadKVEnvStrings",
"reads",
"a",
"file",
"of",
"line",
"terminated",
"key",
"=",
"value",
"pairs",
"and",
"overrides",
"any",
"keys",
"present",
"in",
"the",
"file",
"with",
"additional",
"pairs",
"specified",
"in",
"the",
"override",
"parameter",
".",
"If",
... | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/opts/parse.go#L21-L23 |
159,980 | docker/cli | opts/parse.go | ParseRestartPolicy | func ParseRestartPolicy(policy string) (container.RestartPolicy, error) {
p := container.RestartPolicy{}
if policy == "" {
return p, nil
}
parts := strings.Split(policy, ":")
if len(parts) > 2 {
return p, fmt.Errorf("invalid restart policy format")
}
if len(parts) == 2 {
count, err := strconv.Atoi(parts... | go | func ParseRestartPolicy(policy string) (container.RestartPolicy, error) {
p := container.RestartPolicy{}
if policy == "" {
return p, nil
}
parts := strings.Split(policy, ":")
if len(parts) > 2 {
return p, fmt.Errorf("invalid restart policy format")
}
if len(parts) == 2 {
count, err := strconv.Atoi(parts... | [
"func",
"ParseRestartPolicy",
"(",
"policy",
"string",
")",
"(",
"container",
".",
"RestartPolicy",
",",
"error",
")",
"{",
"p",
":=",
"container",
".",
"RestartPolicy",
"{",
"}",
"\n\n",
"if",
"policy",
"==",
"\"",
"\"",
"{",
"return",
"p",
",",
"nil",
... | // ParseRestartPolicy returns the parsed policy or an error indicating what is incorrect | [
"ParseRestartPolicy",
"returns",
"the",
"parsed",
"policy",
"or",
"an",
"error",
"indicating",
"what",
"is",
"incorrect"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/opts/parse.go#L75-L99 |
159,981 | docker/cli | cli/command/system/info.go | NewInfoCommand | func NewInfoCommand(dockerCli command.Cli) *cobra.Command {
var opts infoOptions
cmd := &cobra.Command{
Use: "info [OPTIONS]",
Short: "Display system-wide information",
Args: cli.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return runInfo(cmd, dockerCli, &opts)
},
}
flags := cmd.F... | go | func NewInfoCommand(dockerCli command.Cli) *cobra.Command {
var opts infoOptions
cmd := &cobra.Command{
Use: "info [OPTIONS]",
Short: "Display system-wide information",
Args: cli.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return runInfo(cmd, dockerCli, &opts)
},
}
flags := cmd.F... | [
"func",
"NewInfoCommand",
"(",
"dockerCli",
"command",
".",
"Cli",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"opts",
"infoOptions",
"\n\n",
"cmd",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",... | // NewInfoCommand creates a new cobra.Command for `docker info` | [
"NewInfoCommand",
"creates",
"a",
"new",
"cobra",
".",
"Command",
"for",
"docker",
"info"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/system/info.go#L44-L61 |
159,982 | docker/cli | cli/command/config/inspect.go | RunConfigInspect | func RunConfigInspect(dockerCli command.Cli, opts InspectOptions) error {
client := dockerCli.Client()
ctx := context.Background()
if opts.Pretty {
opts.Format = "pretty"
}
getRef := func(id string) (interface{}, []byte, error) {
return client.ConfigInspectWithRaw(ctx, id)
}
f := opts.Format
// check if ... | go | func RunConfigInspect(dockerCli command.Cli, opts InspectOptions) error {
client := dockerCli.Client()
ctx := context.Background()
if opts.Pretty {
opts.Format = "pretty"
}
getRef := func(id string) (interface{}, []byte, error) {
return client.ConfigInspectWithRaw(ctx, id)
}
f := opts.Format
// check if ... | [
"func",
"RunConfigInspect",
"(",
"dockerCli",
"command",
".",
"Cli",
",",
"opts",
"InspectOptions",
")",
"error",
"{",
"client",
":=",
"dockerCli",
".",
"Client",
"(",
")",
"\n",
"ctx",
":=",
"context",
".",
"Background",
"(",
")",
"\n\n",
"if",
"opts",
... | // RunConfigInspect inspects the given Swarm config. | [
"RunConfigInspect",
"inspects",
"the",
"given",
"Swarm",
"config",
"."
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/config/inspect.go#L39-L68 |
159,983 | docker/cli | cli/command/formatter/context.go | NewClientContextFormat | func NewClientContextFormat(source string, quiet bool) Format {
if quiet {
return Format(quietContextFormat)
}
if source == TableFormatKey {
return Format(ClientContextTableFormat)
}
return Format(source)
} | go | func NewClientContextFormat(source string, quiet bool) Format {
if quiet {
return Format(quietContextFormat)
}
if source == TableFormatKey {
return Format(ClientContextTableFormat)
}
return Format(source)
} | [
"func",
"NewClientContextFormat",
"(",
"source",
"string",
",",
"quiet",
"bool",
")",
"Format",
"{",
"if",
"quiet",
"{",
"return",
"Format",
"(",
"quietContextFormat",
")",
"\n",
"}",
"\n",
"if",
"source",
"==",
"TableFormatKey",
"{",
"return",
"Format",
"("... | // NewClientContextFormat returns a Format for rendering using a Context | [
"NewClientContextFormat",
"returns",
"a",
"Format",
"for",
"rendering",
"using",
"a",
"Context"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/formatter/context.go#L14-L22 |
159,984 | docker/cli | cli/command/formatter/context.go | ClientContextWrite | func ClientContextWrite(ctx Context, contexts []*ClientContext) error {
render := func(format func(subContext SubContext) error) error {
for _, context := range contexts {
if err := format(&clientContextContext{c: context}); err != nil {
return err
}
}
return nil
}
return ctx.Write(newClientContextCo... | go | func ClientContextWrite(ctx Context, contexts []*ClientContext) error {
render := func(format func(subContext SubContext) error) error {
for _, context := range contexts {
if err := format(&clientContextContext{c: context}); err != nil {
return err
}
}
return nil
}
return ctx.Write(newClientContextCo... | [
"func",
"ClientContextWrite",
"(",
"ctx",
"Context",
",",
"contexts",
"[",
"]",
"*",
"ClientContext",
")",
"error",
"{",
"render",
":=",
"func",
"(",
"format",
"func",
"(",
"subContext",
"SubContext",
")",
"error",
")",
"error",
"{",
"for",
"_",
",",
"co... | // ClientContextWrite writes formatted contexts using the Context | [
"ClientContextWrite",
"writes",
"formatted",
"contexts",
"using",
"the",
"Context"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/formatter/context.go#L35-L45 |
159,985 | docker/cli | cli/compose/schema/schema.go | Version | func Version(config map[string]interface{}) string {
version, ok := config[versionField]
if !ok {
return defaultVersion
}
return normalizeVersion(fmt.Sprintf("%v", version))
} | go | func Version(config map[string]interface{}) string {
version, ok := config[versionField]
if !ok {
return defaultVersion
}
return normalizeVersion(fmt.Sprintf("%v", version))
} | [
"func",
"Version",
"(",
"config",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"string",
"{",
"version",
",",
"ok",
":=",
"config",
"[",
"versionField",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"defaultVersion",
"\n",
"}",
"\n",
"return",
... | // Version returns the version of the config, defaulting to version 1.0 | [
"Version",
"returns",
"the",
"version",
"of",
"the",
"config",
"defaulting",
"to",
"version",
"1",
".",
"0"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/compose/schema/schema.go#L40-L46 |
159,986 | docker/cli | cli/command/task/formatter.go | NewTaskFormat | func NewTaskFormat(source string, quiet bool) formatter.Format {
switch source {
case formatter.TableFormatKey:
if quiet {
return formatter.DefaultQuietFormat
}
return defaultTaskTableFormat
case formatter.RawFormatKey:
if quiet {
return `id: {{.ID}}`
}
return `id: {{.ID}}\nname: {{.Name}}\nimage: ... | go | func NewTaskFormat(source string, quiet bool) formatter.Format {
switch source {
case formatter.TableFormatKey:
if quiet {
return formatter.DefaultQuietFormat
}
return defaultTaskTableFormat
case formatter.RawFormatKey:
if quiet {
return `id: {{.ID}}`
}
return `id: {{.ID}}\nname: {{.Name}}\nimage: ... | [
"func",
"NewTaskFormat",
"(",
"source",
"string",
",",
"quiet",
"bool",
")",
"formatter",
".",
"Format",
"{",
"switch",
"source",
"{",
"case",
"formatter",
".",
"TableFormatKey",
":",
"if",
"quiet",
"{",
"return",
"formatter",
".",
"DefaultQuietFormat",
"\n",
... | // NewTaskFormat returns a Format for rendering using a task Context | [
"NewTaskFormat",
"returns",
"a",
"Format",
"for",
"rendering",
"using",
"a",
"task",
"Context"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/task/formatter.go#L29-L43 |
159,987 | docker/cli | cli/command/image/formatter_history.go | NewHistoryFormat | func NewHistoryFormat(source string, quiet bool, human bool) formatter.Format {
switch source {
case formatter.TableFormatKey:
switch {
case quiet:
return formatter.DefaultQuietFormat
case !human:
return nonHumanHistoryTableFormat
default:
return defaultHistoryTableFormat
}
}
return formatter.Fo... | go | func NewHistoryFormat(source string, quiet bool, human bool) formatter.Format {
switch source {
case formatter.TableFormatKey:
switch {
case quiet:
return formatter.DefaultQuietFormat
case !human:
return nonHumanHistoryTableFormat
default:
return defaultHistoryTableFormat
}
}
return formatter.Fo... | [
"func",
"NewHistoryFormat",
"(",
"source",
"string",
",",
"quiet",
"bool",
",",
"human",
"bool",
")",
"formatter",
".",
"Format",
"{",
"switch",
"source",
"{",
"case",
"formatter",
".",
"TableFormatKey",
":",
"switch",
"{",
"case",
"quiet",
":",
"return",
... | // NewHistoryFormat returns a format for rendering an HistoryContext | [
"NewHistoryFormat",
"returns",
"a",
"format",
"for",
"rendering",
"an",
"HistoryContext"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/image/formatter_history.go#L24-L38 |
159,988 | docker/cli | cli/command/image/formatter_history.go | HistoryWrite | func HistoryWrite(ctx formatter.Context, human bool, histories []image.HistoryResponseItem) error {
render := func(format func(subContext formatter.SubContext) error) error {
for _, history := range histories {
historyCtx := &historyContext{trunc: ctx.Trunc, h: history, human: human}
if err := format(historyCt... | go | func HistoryWrite(ctx formatter.Context, human bool, histories []image.HistoryResponseItem) error {
render := func(format func(subContext formatter.SubContext) error) error {
for _, history := range histories {
historyCtx := &historyContext{trunc: ctx.Trunc, h: history, human: human}
if err := format(historyCt... | [
"func",
"HistoryWrite",
"(",
"ctx",
"formatter",
".",
"Context",
",",
"human",
"bool",
",",
"histories",
"[",
"]",
"image",
".",
"HistoryResponseItem",
")",
"error",
"{",
"render",
":=",
"func",
"(",
"format",
"func",
"(",
"subContext",
"formatter",
".",
"... | // HistoryWrite writes the context | [
"HistoryWrite",
"writes",
"the",
"context"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/image/formatter_history.go#L41-L61 |
159,989 | docker/cli | cli/command/engine/activate.go | newActivateCommand | func newActivateCommand(dockerCli command.Cli) *cobra.Command {
var options activateOptions
options.licenseLoginFunc = licenseutils.Login
cmd := &cobra.Command{
Use: "activate [OPTIONS]",
Short: "Activate Enterprise Edition",
Long: `Activate Enterprise Edition.
With this command you may apply an existing D... | go | func newActivateCommand(dockerCli command.Cli) *cobra.Command {
var options activateOptions
options.licenseLoginFunc = licenseutils.Login
cmd := &cobra.Command{
Use: "activate [OPTIONS]",
Short: "Activate Enterprise Edition",
Long: `Activate Enterprise Edition.
With this command you may apply an existing D... | [
"func",
"newActivateCommand",
"(",
"dockerCli",
"command",
".",
"Cli",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"options",
"activateOptions",
"\n",
"options",
".",
"licenseLoginFunc",
"=",
"licenseutils",
".",
"Login",
"\n\n",
"cmd",
":=",
"&",
"cobra",
... | // newActivateCommand creates a new `docker engine activate` command | [
"newActivateCommand",
"creates",
"a",
"new",
"docker",
"engine",
"activate",
"command"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/engine/activate.go#L31-L70 |
159,990 | docker/cli | cli-plugins/manager/plugin.go | newPlugin | func newPlugin(c Candidate, rootcmd *cobra.Command) (Plugin, error) {
path := c.Path()
if path == "" {
return Plugin{}, errors.New("plugin candidate path cannot be empty")
}
// The candidate listing process should have skipped anything
// which would fail here, so there are all real errors.
fullname := filepat... | go | func newPlugin(c Candidate, rootcmd *cobra.Command) (Plugin, error) {
path := c.Path()
if path == "" {
return Plugin{}, errors.New("plugin candidate path cannot be empty")
}
// The candidate listing process should have skipped anything
// which would fail here, so there are all real errors.
fullname := filepat... | [
"func",
"newPlugin",
"(",
"c",
"Candidate",
",",
"rootcmd",
"*",
"cobra",
".",
"Command",
")",
"(",
"Plugin",
",",
"error",
")",
"{",
"path",
":=",
"c",
".",
"Path",
"(",
")",
"\n",
"if",
"path",
"==",
"\"",
"\"",
"{",
"return",
"Plugin",
"{",
"}... | // newPlugin determines if the given candidate is valid and returns a
// Plugin. If the candidate fails one of the tests then `Plugin.Err`
// is set, and is always a `pluginError`, but the `Plugin` is still
// returned with no error. An error is only returned due to a
// non-recoverable error. | [
"newPlugin",
"determines",
"if",
"the",
"given",
"candidate",
"is",
"valid",
"and",
"returns",
"a",
"Plugin",
".",
"If",
"the",
"candidate",
"fails",
"one",
"of",
"the",
"tests",
"then",
"Plugin",
".",
"Err",
"is",
"set",
"and",
"is",
"always",
"a",
"plu... | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli-plugins/manager/plugin.go#L36-L107 |
159,991 | docker/cli | cli/command/stack/cmd.go | NewStackCommand | func NewStackCommand(dockerCli command.Cli) *cobra.Command {
var opts commonOptions
cmd := &cobra.Command{
Use: "stack [OPTIONS]",
Short: "Manage Docker stacks",
Args: cli.NoArgs,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
orchestrator, err := getOrchestrator(dockerCli, cmd)
i... | go | func NewStackCommand(dockerCli command.Cli) *cobra.Command {
var opts commonOptions
cmd := &cobra.Command{
Use: "stack [OPTIONS]",
Short: "Manage Docker stacks",
Args: cli.NoArgs,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
orchestrator, err := getOrchestrator(dockerCli, cmd)
i... | [
"func",
"NewStackCommand",
"(",
"dockerCli",
"command",
".",
"Cli",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"opts",
"commonOptions",
"\n",
"cmd",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
"... | // NewStackCommand returns a cobra command for `stack` subcommands | [
"NewStackCommand",
"returns",
"a",
"cobra",
"command",
"for",
"stack",
"subcommands"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/stack/cmd.go#L28-L74 |
159,992 | docker/cli | cli/command/stack/cmd.go | NewTopLevelDeployCommand | func NewTopLevelDeployCommand(dockerCli command.Cli) *cobra.Command {
cmd := newDeployCommand(dockerCli, nil)
// Remove the aliases at the top level
cmd.Aliases = []string{}
cmd.Annotations = map[string]string{
"experimental": "",
"version": "1.25",
}
return cmd
} | go | func NewTopLevelDeployCommand(dockerCli command.Cli) *cobra.Command {
cmd := newDeployCommand(dockerCli, nil)
// Remove the aliases at the top level
cmd.Aliases = []string{}
cmd.Annotations = map[string]string{
"experimental": "",
"version": "1.25",
}
return cmd
} | [
"func",
"NewTopLevelDeployCommand",
"(",
"dockerCli",
"command",
".",
"Cli",
")",
"*",
"cobra",
".",
"Command",
"{",
"cmd",
":=",
"newDeployCommand",
"(",
"dockerCli",
",",
"nil",
")",
"\n",
"// Remove the aliases at the top level",
"cmd",
".",
"Aliases",
"=",
"... | // NewTopLevelDeployCommand returns a command for `docker deploy` | [
"NewTopLevelDeployCommand",
"returns",
"a",
"command",
"for",
"docker",
"deploy"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/stack/cmd.go#L77-L86 |
159,993 | docker/cli | cli/command/image/load.go | NewLoadCommand | func NewLoadCommand(dockerCli command.Cli) *cobra.Command {
var opts loadOptions
cmd := &cobra.Command{
Use: "load [OPTIONS]",
Short: "Load an image from a tar archive or STDIN",
Args: cli.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return runLoad(dockerCli, opts)
},
}
flags := c... | go | func NewLoadCommand(dockerCli command.Cli) *cobra.Command {
var opts loadOptions
cmd := &cobra.Command{
Use: "load [OPTIONS]",
Short: "Load an image from a tar archive or STDIN",
Args: cli.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return runLoad(dockerCli, opts)
},
}
flags := c... | [
"func",
"NewLoadCommand",
"(",
"dockerCli",
"command",
".",
"Cli",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"opts",
"loadOptions",
"\n\n",
"cmd",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",... | // NewLoadCommand creates a new `docker load` command | [
"NewLoadCommand",
"creates",
"a",
"new",
"docker",
"load",
"command"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/image/load.go#L21-L39 |
159,994 | docker/cli | cli/command/engine/cmd.go | NewEngineCommand | func NewEngineCommand(dockerCli command.Cli) *cobra.Command {
cmd := &cobra.Command{
Use: "engine COMMAND",
Short: "Manage the docker engine",
Args: cli.NoArgs,
RunE: command.ShowHelp(dockerCli.Err()),
}
cmd.AddCommand(
newActivateCommand(dockerCli),
newCheckForUpdatesCommand(dockerCli),
newUpdateC... | go | func NewEngineCommand(dockerCli command.Cli) *cobra.Command {
cmd := &cobra.Command{
Use: "engine COMMAND",
Short: "Manage the docker engine",
Args: cli.NoArgs,
RunE: command.ShowHelp(dockerCli.Err()),
}
cmd.AddCommand(
newActivateCommand(dockerCli),
newCheckForUpdatesCommand(dockerCli),
newUpdateC... | [
"func",
"NewEngineCommand",
"(",
"dockerCli",
"command",
".",
"Cli",
")",
"*",
"cobra",
".",
"Command",
"{",
"cmd",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Args",
":",
"cli",
".",
"NoArg... | // NewEngineCommand returns a cobra command for `engine` subcommands | [
"NewEngineCommand",
"returns",
"a",
"cobra",
"command",
"for",
"engine",
"subcommands"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/engine/cmd.go#L10-L23 |
159,995 | docker/cli | cli/command/container/exec.go | NewExecCommand | func NewExecCommand(dockerCli command.Cli) *cobra.Command {
options := newExecOptions()
cmd := &cobra.Command{
Use: "exec [OPTIONS] CONTAINER COMMAND [ARG...]",
Short: "Run a command in a running container",
Args: cli.RequiresMinArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
options.con... | go | func NewExecCommand(dockerCli command.Cli) *cobra.Command {
options := newExecOptions()
cmd := &cobra.Command{
Use: "exec [OPTIONS] CONTAINER COMMAND [ARG...]",
Short: "Run a command in a running container",
Args: cli.RequiresMinArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
options.con... | [
"func",
"NewExecCommand",
"(",
"dockerCli",
"command",
".",
"Cli",
")",
"*",
"cobra",
".",
"Command",
"{",
"options",
":=",
"newExecOptions",
"(",
")",
"\n\n",
"cmd",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
... | // NewExecCommand creates a new cobra.Command for `docker exec` | [
"NewExecCommand",
"creates",
"a",
"new",
"cobra",
".",
"Command",
"for",
"docker",
"exec"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/container/exec.go#L37-L66 |
159,996 | docker/cli | cli/command/container/exec.go | parseExec | func parseExec(opts execOptions, configFile *configfile.ConfigFile) *types.ExecConfig {
execConfig := &types.ExecConfig{
User: opts.user,
Privileged: opts.privileged,
Tty: opts.tty,
Cmd: opts.command,
Detach: opts.detach,
Env: opts.env.GetAll(),
WorkingDir: opts.workdir,
}... | go | func parseExec(opts execOptions, configFile *configfile.ConfigFile) *types.ExecConfig {
execConfig := &types.ExecConfig{
User: opts.user,
Privileged: opts.privileged,
Tty: opts.tty,
Cmd: opts.command,
Detach: opts.detach,
Env: opts.env.GetAll(),
WorkingDir: opts.workdir,
}... | [
"func",
"parseExec",
"(",
"opts",
"execOptions",
",",
"configFile",
"*",
"configfile",
".",
"ConfigFile",
")",
"*",
"types",
".",
"ExecConfig",
"{",
"execConfig",
":=",
"&",
"types",
".",
"ExecConfig",
"{",
"User",
":",
"opts",
".",
"user",
",",
"Privilege... | // parseExec parses the specified args for the specified command and generates
// an ExecConfig from it. | [
"parseExec",
"parses",
"the",
"specified",
"args",
"for",
"the",
"specified",
"command",
"and",
"generates",
"an",
"ExecConfig",
"from",
"it",
"."
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/container/exec.go#L188-L214 |
159,997 | docker/cli | cli/streams/stream.go | RestoreTerminal | func (s *commonStream) RestoreTerminal() {
if s.state != nil {
term.RestoreTerminal(s.fd, s.state)
}
} | go | func (s *commonStream) RestoreTerminal() {
if s.state != nil {
term.RestoreTerminal(s.fd, s.state)
}
} | [
"func",
"(",
"s",
"*",
"commonStream",
")",
"RestoreTerminal",
"(",
")",
"{",
"if",
"s",
".",
"state",
"!=",
"nil",
"{",
"term",
".",
"RestoreTerminal",
"(",
"s",
".",
"fd",
",",
"s",
".",
"state",
")",
"\n",
"}",
"\n",
"}"
] | // RestoreTerminal restores normal mode to the terminal | [
"RestoreTerminal",
"restores",
"normal",
"mode",
"to",
"the",
"terminal"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/streams/stream.go#L25-L29 |
159,998 | docker/cli | cli/command/system/cmd.go | NewSystemCommand | func NewSystemCommand(dockerCli command.Cli) *cobra.Command {
cmd := &cobra.Command{
Use: "system",
Short: "Manage Docker",
Args: cli.NoArgs,
RunE: command.ShowHelp(dockerCli.Err()),
}
cmd.AddCommand(
NewEventsCommand(dockerCli),
NewInfoCommand(dockerCli),
newDiskUsageCommand(dockerCli),
newPrune... | go | func NewSystemCommand(dockerCli command.Cli) *cobra.Command {
cmd := &cobra.Command{
Use: "system",
Short: "Manage Docker",
Args: cli.NoArgs,
RunE: command.ShowHelp(dockerCli.Err()),
}
cmd.AddCommand(
NewEventsCommand(dockerCli),
NewInfoCommand(dockerCli),
newDiskUsageCommand(dockerCli),
newPrune... | [
"func",
"NewSystemCommand",
"(",
"dockerCli",
"command",
".",
"Cli",
")",
"*",
"cobra",
".",
"Command",
"{",
"cmd",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Args",
":",
"cli",
".",
"NoArg... | // NewSystemCommand returns a cobra command for `system` subcommands | [
"NewSystemCommand",
"returns",
"a",
"cobra",
"command",
"for",
"system",
"subcommands"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/command/system/cmd.go#L10-L26 |
159,999 | docker/cli | cli/config/config.go | Path | func Path(p ...string) (string, error) {
path := filepath.Join(append([]string{Dir()}, p...)...)
if !strings.HasPrefix(path, Dir()+string(filepath.Separator)) {
return "", errors.Errorf("path %q is outside of root config directory %q", path, Dir())
}
return path, nil
} | go | func Path(p ...string) (string, error) {
path := filepath.Join(append([]string{Dir()}, p...)...)
if !strings.HasPrefix(path, Dir()+string(filepath.Separator)) {
return "", errors.Errorf("path %q is outside of root config directory %q", path, Dir())
}
return path, nil
} | [
"func",
"Path",
"(",
"p",
"...",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"path",
":=",
"filepath",
".",
"Join",
"(",
"append",
"(",
"[",
"]",
"string",
"{",
"Dir",
"(",
")",
"}",
",",
"p",
"...",
")",
"...",
")",
"\n",
"if",
"!"... | // Path returns the path to a file relative to the config dir | [
"Path",
"returns",
"the",
"path",
"to",
"a",
"file",
"relative",
"to",
"the",
"config",
"dir"
] | 3273c2e23546dddd0ff8bb499f4aba02fe60bf30 | https://github.com/docker/cli/blob/3273c2e23546dddd0ff8bb499f4aba02fe60bf30/cli/config/config.go#L51-L57 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.