MCPcopy Index your code
hub / github.com/docker/cli / newUseCommand

Function newUseCommand

cli/command/context/use.go:13–26  ·  view source on GitHub ↗
(dockerCLI command.Cli)

Source from the content-addressed store, hash-verified

11)
12
13func newUseCommand(dockerCLI command.Cli) *cobra.Command {
14 cmd := &cobra.Command{
15 Use: "use CONTEXT",
16 Short: "Set the default docker context",
17 Args: cobra.ExactArgs(1),
18 RunE: func(cmd *cobra.Command, args []string) error {
19 name := args[0]
20 return runUse(dockerCLI, name)
21 },
22 ValidArgsFunction: completeContextNames(dockerCLI, 1, false),
23 DisableFlagsInUseLine: true,
24 }
25 return cmd
26}
27
28// runUse set the current Docker context
29func runUse(dockerCLI command.Cli, name string) error {

Callers 6

newContextCommandFunction · 0.85
TestUseFunction · 0.85
TestUseNoExistFunction · 0.85
TestUseHostOverrideFunction · 0.85
TestUseHostOverrideEmptyFunction · 0.85

Calls 2

runUseFunction · 0.85
completeContextNamesFunction · 0.70

Tested by 5

TestUseFunction · 0.68
TestUseNoExistFunction · 0.68
TestUseHostOverrideFunction · 0.68
TestUseHostOverrideEmptyFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…