mirror of https://github.com/docker/cli.git
support settings in docker plugins install
Signed-off-by: Victor Vieux <vieux@docker.com>
This commit is contained in:
parent
6780c318a3
commit
41513e3051
|
@ -18,16 +18,20 @@ type pluginOptions struct {
|
||||||
name string
|
name string
|
||||||
grantPerms bool
|
grantPerms bool
|
||||||
disable bool
|
disable bool
|
||||||
|
args []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func newInstallCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func newInstallCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
var options pluginOptions
|
var options pluginOptions
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "install [OPTIONS] PLUGIN",
|
Use: "install [OPTIONS] PLUGIN [KEY=VALUE...]",
|
||||||
Short: "Install a plugin",
|
Short: "Install a plugin",
|
||||||
Args: cli.ExactArgs(1), // TODO: allow for set args
|
Args: cli.RequiresMinArgs(1),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
options.name = args[0]
|
options.name = args[0]
|
||||||
|
if len(args) > 1 {
|
||||||
|
options.args = args[1:]
|
||||||
|
}
|
||||||
return runInstall(dockerCli, options)
|
return runInstall(dockerCli, options)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -75,6 +79,7 @@ func runInstall(dockerCli *command.DockerCli, opts pluginOptions) error {
|
||||||
AcceptPermissionsFunc: acceptPrivileges(dockerCli, opts.name),
|
AcceptPermissionsFunc: acceptPrivileges(dockerCli, opts.name),
|
||||||
// TODO: Rename PrivilegeFunc, it has nothing to do with privileges
|
// TODO: Rename PrivilegeFunc, it has nothing to do with privileges
|
||||||
PrivilegeFunc: registryAuthFunc,
|
PrivilegeFunc: registryAuthFunc,
|
||||||
|
Args: opts.args,
|
||||||
}
|
}
|
||||||
if err := dockerCli.Client().PluginInstall(ctx, ref.String(), options); err != nil {
|
if err := dockerCli.Client().PluginInstall(ctx, ref.String(), options); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
|
|
||||||
func newSetCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func newSetCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "set PLUGIN key1=value1 [key2=value2...]",
|
Use: "set PLUGIN KEY=VALUE [KEY=VALUE...]",
|
||||||
Short: "Change settings for a plugin",
|
Short: "Change settings for a plugin",
|
||||||
Args: cli.RequiresMinArgs(2),
|
Args: cli.RequiresMinArgs(2),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
|
Loading…
Reference in New Issue