mirror of https://github.com/docker/cli.git
Merge pull request #1123 from vdemeester/export-save-push
Export Push and Save
This commit is contained in:
commit
449f0c067d
|
@ -26,7 +26,7 @@ func NewPushCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
Args: cli.ExactArgs(1),
|
Args: cli.ExactArgs(1),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
opts.remote = args[0]
|
opts.remote = args[0]
|
||||||
return runPush(dockerCli, opts)
|
return RunPush(dockerCli, opts)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,8 @@ func NewPushCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runPush(dockerCli command.Cli, opts pushOptions) error {
|
// RunPush performs a push against the engine based on the specified options
|
||||||
|
func RunPush(dockerCli command.Cli, opts pushOptions) error {
|
||||||
ref, err := reference.ParseNormalizedNamed(opts.remote)
|
ref, err := reference.ParseNormalizedNamed(opts.remote)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -27,7 +27,7 @@ func NewSaveCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
Args: cli.RequiresMinArgs(1),
|
Args: cli.RequiresMinArgs(1),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
opts.images = args
|
opts.images = args
|
||||||
return runSave(dockerCli, opts)
|
return RunSave(dockerCli, opts)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,8 @@ func NewSaveCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runSave(dockerCli command.Cli, opts saveOptions) error {
|
// RunSave performs a save against the engine based on the specified options
|
||||||
|
func RunSave(dockerCli command.Cli, opts saveOptions) error {
|
||||||
if opts.output == "" && dockerCli.Out().IsTerminal() {
|
if opts.output == "" && dockerCli.Out().IsTerminal() {
|
||||||
return errors.New("cowardly refusing to save to a terminal. Use the -o flag or redirect")
|
return errors.New("cowardly refusing to save to a terminal. Use the -o flag or redirect")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue