summaryrefslogtreecommitdiff
path: root/cmd/podmanV2/registry
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podmanV2/registry')
-rw-r--r--cmd/podmanV2/registry/registry.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/cmd/podmanV2/registry/registry.go b/cmd/podmanV2/registry/registry.go
index 401f82718..8ff44041f 100644
--- a/cmd/podmanV2/registry/registry.go
+++ b/cmd/podmanV2/registry/registry.go
@@ -113,6 +113,14 @@ func SubCommandExists(cmd *cobra.Command, args []string) error {
return errors.Errorf("missing command '%[1]s COMMAND'\nTry '%[1]s --help' for more information.", cmd.CommandPath())
}
+// IdOrLatestArgs used to validate a nameOrId was provided or the "--latest" flag
+func IdOrLatestArgs(cmd *cobra.Command, args []string) error {
+ if len(args) > 1 || (len(args) == 0 && !cmd.Flag("latest").Changed) {
+ return errors.New(`command requires a name, id or the "--latest" flag`)
+ }
+ return nil
+}
+
type podmanContextKey string
var podmanFactsKey = podmanContextKey("engineOptions")