Skip to content

Commit

Permalink
Export Push and Save
Browse files Browse the repository at this point in the history
As we did for `Pull`, it will be helpful to expose the push and save
implementation.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
  • Loading branch information
vdemeester committed Jun 14, 2018
1 parent 70db8de commit e43c792
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions cli/command/image/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func NewPushCommand(dockerCli command.Cli) *cobra.Command {
Args: cli.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
opts.remote = args[0]
return runPush(dockerCli, opts)
return RunPush(dockerCli, opts)
},
}

Expand All @@ -37,7 +37,8 @@ func NewPushCommand(dockerCli command.Cli) *cobra.Command {
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)
if err != nil {
return err
Expand Down
5 changes: 3 additions & 2 deletions cli/command/image/save.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func NewSaveCommand(dockerCli command.Cli) *cobra.Command {
Args: cli.RequiresMinArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
opts.images = args
return runSave(dockerCli, opts)
return RunSave(dockerCli, opts)
},
}

Expand All @@ -38,7 +38,8 @@ func NewSaveCommand(dockerCli command.Cli) *cobra.Command {
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() {
return errors.New("cowardly refusing to save to a terminal. Use the -o flag or redirect")
}
Expand Down

0 comments on commit e43c792

Please sign in to comment.