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

Function runInstall

cli/command/plugin/install.go:79–108  ·  view source on GitHub ↗
(ctx context.Context, dockerCLI command.Cli, opts pluginOptions)

Source from the content-addressed store, hash-verified

77}
78
79func runInstall(ctx context.Context, dockerCLI command.Cli, opts pluginOptions) error {
80 var localName string
81 if opts.localName != "" {
82 aref, err := reference.ParseNormalizedNamed(opts.localName)
83 if err != nil {
84 return err
85 }
86 if _, ok := aref.(reference.Canonical); ok {
87 return fmt.Errorf("invalid name: %s", opts.localName)
88 }
89 localName = reference.FamiliarString(reference.TagNameOnly(aref))
90 }
91
92 options, err := buildPullConfig(dockerCLI, opts)
93 if err != nil {
94 return err
95 }
96 responseBody, err := dockerCLI.Client().PluginInstall(ctx, localName, options)
97 if err != nil {
98 return err
99 }
100 defer func() {
101 _ = responseBody.Close()
102 }()
103 if err := jsonstream.Display(ctx, responseBody, dockerCLI.Out()); err != nil {
104 return err
105 }
106 _, _ = fmt.Fprintln(dockerCLI.Out(), "Installed plugin", opts.remote) // todo: return proper values from the API for this result
107 return nil
108}
109
110func acceptPrivileges(dockerCLI command.Streams, name string) func(ctx context.Context, privileges plugin.Privileges) (bool, error) {
111 return func(ctx context.Context, privileges plugin.Privileges) (bool, error) {

Callers 1

newInstallCommandFunction · 0.85

Calls 5

buildPullConfigFunction · 0.85
PluginInstallMethod · 0.80
ClientMethod · 0.65
OutMethod · 0.65
CloseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…