summaryrefslogtreecommitdiff
path: root/cmd/podman/images/import.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-05-05 15:57:08 +0200
committerGitHub <noreply@github.com>2020-05-05 15:57:08 +0200
commit4a1331d0afd9a21ff9465916d4006ff7297ae07c (patch)
tree97b56fc4361ed81c84dff9e07d46abf302670f1b /cmd/podman/images/import.go
parentc313eec620becf710af925c02b7e5dfd80bd9ba6 (diff)
parent6ed3b8841f00d2aa1f86678c079a119e027b0d66 (diff)
downloadpodman-4a1331d0afd9a21ff9465916d4006ff7297ae07c.tar.gz
podman-4a1331d0afd9a21ff9465916d4006ff7297ae07c.tar.bz2
podman-4a1331d0afd9a21ff9465916d4006ff7297ae07c.zip
Merge pull request #6077 from rhatdan/v2
Fix errors found when comparing podman v1 --help versus V2
Diffstat (limited to 'cmd/podman/images/import.go')
-rw-r--r--cmd/podman/images/import.go23
1 files changed, 22 insertions, 1 deletions
diff --git a/cmd/podman/images/import.go b/cmd/podman/images/import.go
index 1c0568762..0e16128ce 100644
--- a/cmd/podman/images/import.go
+++ b/cmd/podman/images/import.go
@@ -10,6 +10,7 @@ import (
"github.com/hashicorp/go-multierror"
"github.com/pkg/errors"
"github.com/spf13/cobra"
+ "github.com/spf13/pflag"
)
var (
@@ -26,6 +27,17 @@ var (
cat ctr.tar | podman -q import --message "importing the ctr.tar tarball" - image-imported
cat ctr.tar | podman import -`,
}
+
+ imageImportCommand = &cobra.Command{
+ Args: cobra.MinimumNArgs(1),
+ Use: importCommand.Use,
+ Short: importCommand.Short,
+ Long: importCommand.Long,
+ RunE: importCommand.RunE,
+ Example: `podman image import http://example.com/ctr.tar url-image
+ cat ctr.tar | podman -q image import --message "importing the ctr.tar tarball" - image-imported
+ cat ctr.tar | podman image import -`,
+ }
)
var (
@@ -37,8 +49,17 @@ func init() {
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: importCommand,
})
+ importFlags(importCommand.Flags())
+
+ registry.Commands = append(registry.Commands, registry.CliCommand{
+ Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
+ Command: imageImportCommand,
+ Parent: imageCmd,
+ })
+ importFlags(imageImportCommand.Flags())
+}
- flags := importCommand.Flags()
+func importFlags(flags *pflag.FlagSet) {
flags.StringArrayVarP(&importOpts.Changes, "change", "c", []string{}, "Apply the following possible instructions to the created image (default []): CMD | ENTRYPOINT | ENV | EXPOSE | LABEL | STOPSIGNAL | USER | VOLUME | WORKDIR")
flags.StringVarP(&importOpts.Message, "message", "m", "", "Set commit message for imported image")
flags.BoolVarP(&importOpts.Quiet, "quiet", "q", false, "Suppress output")