diff options
author | Jhon Honce <jhonce@redhat.com> | 2021-05-18 11:23:25 -0700 |
---|---|---|
committer | Jhon Honce <jhonce@redhat.com> | 2021-05-27 11:40:43 -0700 |
commit | 33944cefe7c1f3e11c8389bedb3e4c80af8541bd (patch) | |
tree | 594d3da7b2cb2a8620be0afbca2cd27087192326 /cmd/podman/manifest | |
parent | 4f4a440afd521913745c314f2bebd0da45d9668e (diff) | |
download | podman-33944cefe7c1f3e11c8389bedb3e4c80af8541bd.tar.gz podman-33944cefe7c1f3e11c8389bedb3e4c80af8541bd.tar.bz2 podman-33944cefe7c1f3e11c8389bedb3e4c80af8541bd.zip |
[Techinal Debt] Cleanup ABI vs. Tunnel CLI commands
[NO TESTS NEEDED]
This commit cleans up two issues:
* Most commands support all EngineModes so default to that. Let
outlayers declare their intent.
* Use cobra.Annotations to set supported EngineMode. This simplies
instantiating commands as there is now one method to communicate a
commands requirements rather than two.
* Combined aliased commands into one file
* Fixed aliased commands where Args field did not match
* Updated examples in README.md for writing commands
* Remove redundant flag DisableFlagsInUseLine in cobra.Command
initialization.
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'cmd/podman/manifest')
-rw-r--r-- | cmd/podman/manifest/add.go | 1 | ||||
-rw-r--r-- | cmd/podman/manifest/annotate.go | 2 | ||||
-rw-r--r-- | cmd/podman/manifest/create.go | 1 | ||||
-rw-r--r-- | cmd/podman/manifest/exists.go | 2 | ||||
-rw-r--r-- | cmd/podman/manifest/inspect.go | 17 | ||||
-rw-r--r-- | cmd/podman/manifest/manifest.go | 2 | ||||
-rw-r--r-- | cmd/podman/manifest/push.go | 1 | ||||
-rw-r--r-- | cmd/podman/manifest/remove.go | 17 | ||||
-rw-r--r-- | cmd/podman/manifest/rm.go | 17 |
9 files changed, 22 insertions, 38 deletions
diff --git a/cmd/podman/manifest/add.go b/cmd/podman/manifest/add.go index 2499dc2e8..9d219601c 100644 --- a/cmd/podman/manifest/add.go +++ b/cmd/podman/manifest/add.go @@ -39,7 +39,6 @@ var ( func init() { registry.Commands = append(registry.Commands, registry.CliCommand{ - Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode}, Command: addCmd, Parent: manifestCmd, }) diff --git a/cmd/podman/manifest/annotate.go b/cmd/podman/manifest/annotate.go index f5ec13bf2..d806ce9e6 100644 --- a/cmd/podman/manifest/annotate.go +++ b/cmd/podman/manifest/annotate.go @@ -15,6 +15,7 @@ import ( var ( manifestAnnotateOpts = entities.ManifestAnnotateOptions{} annotateCmd = &cobra.Command{ + Annotations: map[string]string{registry.EngineMode: registry.ABIMode}, Use: "annotate [options] LIST IMAGE", Short: "Add or update information about an entry in a manifest list or image index", Long: "Adds or updates information about an entry in a manifest list or image index.", @@ -27,7 +28,6 @@ var ( func init() { registry.Commands = append(registry.Commands, registry.CliCommand{ - Mode: []entities.EngineMode{entities.ABIMode}, Command: annotateCmd, Parent: manifestCmd, }) diff --git a/cmd/podman/manifest/create.go b/cmd/podman/manifest/create.go index a15b129d5..9f7d74d14 100644 --- a/cmd/podman/manifest/create.go +++ b/cmd/podman/manifest/create.go @@ -27,7 +27,6 @@ var ( func init() { registry.Commands = append(registry.Commands, registry.CliCommand{ - Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode}, Command: createCmd, Parent: manifestCmd, }) diff --git a/cmd/podman/manifest/exists.go b/cmd/podman/manifest/exists.go index 7fed1f25c..55318330d 100644 --- a/cmd/podman/manifest/exists.go +++ b/cmd/podman/manifest/exists.go @@ -3,7 +3,6 @@ package manifest import ( "github.com/containers/podman/v3/cmd/podman/common" "github.com/containers/podman/v3/cmd/podman/registry" - "github.com/containers/podman/v3/pkg/domain/entities" "github.com/spf13/cobra" ) @@ -21,7 +20,6 @@ var ( func init() { registry.Commands = append(registry.Commands, registry.CliCommand{ - Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode}, Command: existsCmd, Parent: manifestCmd, }) diff --git a/cmd/podman/manifest/inspect.go b/cmd/podman/manifest/inspect.go index 118c0ae70..d444f9066 100644 --- a/cmd/podman/manifest/inspect.go +++ b/cmd/podman/manifest/inspect.go @@ -6,26 +6,23 @@ import ( "github.com/containers/podman/v3/cmd/podman/common" "github.com/containers/podman/v3/cmd/podman/registry" - "github.com/containers/podman/v3/pkg/domain/entities" "github.com/spf13/cobra" ) var ( inspectCmd = &cobra.Command{ - Use: "inspect IMAGE", - Short: "Display the contents of a manifest list or image index", - Long: "Display the contents of a manifest list or image index.", - RunE: inspect, - ValidArgsFunction: common.AutocompleteImages, - Example: "podman manifest inspect localhost/list", - Args: cobra.ExactArgs(1), - DisableFlagsInUseLine: true, + Use: "inspect IMAGE", + Short: "Display the contents of a manifest list or image index", + Long: "Display the contents of a manifest list or image index.", + RunE: inspect, + ValidArgsFunction: common.AutocompleteImages, + Example: "podman manifest inspect localhost/list", + Args: cobra.ExactArgs(1), } ) func init() { registry.Commands = append(registry.Commands, registry.CliCommand{ - Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode}, Command: inspectCmd, Parent: manifestCmd, }) diff --git a/cmd/podman/manifest/manifest.go b/cmd/podman/manifest/manifest.go index c725078bf..98d5199f1 100644 --- a/cmd/podman/manifest/manifest.go +++ b/cmd/podman/manifest/manifest.go @@ -3,7 +3,6 @@ package manifest import ( "github.com/containers/podman/v3/cmd/podman/registry" "github.com/containers/podman/v3/cmd/podman/validate" - "github.com/containers/podman/v3/pkg/domain/entities" "github.com/spf13/cobra" ) @@ -26,7 +25,6 @@ var ( func init() { registry.Commands = append(registry.Commands, registry.CliCommand{ - Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode}, Command: manifestCmd, }) } diff --git a/cmd/podman/manifest/push.go b/cmd/podman/manifest/push.go index 1dae5cc95..8b13f6dde 100644 --- a/cmd/podman/manifest/push.go +++ b/cmd/podman/manifest/push.go @@ -39,7 +39,6 @@ var ( func init() { registry.Commands = append(registry.Commands, registry.CliCommand{ - Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode}, Command: pushCmd, Parent: manifestCmd, }) diff --git a/cmd/podman/manifest/remove.go b/cmd/podman/manifest/remove.go index 1d1128166..c44c0991e 100644 --- a/cmd/podman/manifest/remove.go +++ b/cmd/podman/manifest/remove.go @@ -6,27 +6,24 @@ import ( "github.com/containers/podman/v3/cmd/podman/common" "github.com/containers/podman/v3/cmd/podman/registry" - "github.com/containers/podman/v3/pkg/domain/entities" "github.com/pkg/errors" "github.com/spf13/cobra" ) var ( removeCmd = &cobra.Command{ - Use: "remove LIST IMAGE", - Short: "Remove an entry from a manifest list or image index", - Long: "Removes an image from a manifest list or image index.", - RunE: remove, - ValidArgsFunction: common.AutocompleteImages, - Example: `podman manifest remove mylist:v1.11 sha256:15352d97781ffdf357bf3459c037be3efac4133dc9070c2dce7eca7c05c3e736`, - Args: cobra.ExactArgs(2), - DisableFlagsInUseLine: true, + Use: "remove LIST IMAGE", + Short: "Remove an entry from a manifest list or image index", + Long: "Removes an image from a manifest list or image index.", + RunE: remove, + ValidArgsFunction: common.AutocompleteImages, + Example: `podman manifest remove mylist:v1.11 sha256:15352d97781ffdf357bf3459c037be3efac4133dc9070c2dce7eca7c05c3e736`, + Args: cobra.ExactArgs(2), } ) func init() { registry.Commands = append(registry.Commands, registry.CliCommand{ - Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode}, Command: removeCmd, Parent: manifestCmd, }) diff --git a/cmd/podman/manifest/rm.go b/cmd/podman/manifest/rm.go index 58c0de886..5e78197ed 100644 --- a/cmd/podman/manifest/rm.go +++ b/cmd/podman/manifest/rm.go @@ -6,27 +6,24 @@ import ( "github.com/containers/podman/v3/cmd/podman/common" "github.com/containers/podman/v3/cmd/podman/registry" - "github.com/containers/podman/v3/pkg/domain/entities" "github.com/containers/podman/v3/pkg/errorhandling" "github.com/spf13/cobra" ) var ( rmCmd = &cobra.Command{ - Use: "rm LIST", - Short: "Remove manifest list or image index from local storage", - Long: "Remove manifest list or image index from local storage.", - RunE: rm, - ValidArgsFunction: common.AutocompleteImages, - Example: `podman manifest rm mylist:v1.11`, - Args: cobra.ExactArgs(1), - DisableFlagsInUseLine: true, + Use: "rm LIST", + Short: "Remove manifest list or image index from local storage", + Long: "Remove manifest list or image index from local storage.", + RunE: rm, + ValidArgsFunction: common.AutocompleteImages, + Example: `podman manifest rm mylist:v1.11`, + Args: cobra.ExactArgs(1), } ) func init() { registry.Commands = append(registry.Commands, registry.CliCommand{ - Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode}, Command: rmCmd, Parent: manifestCmd, }) |