diff options
Diffstat (limited to 'cmd/podmanV2/registry/registry.go')
-rw-r--r-- | cmd/podmanV2/registry/registry.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/cmd/podmanV2/registry/registry.go b/cmd/podmanV2/registry/registry.go index 401f82718..07c2b33ff 100644 --- a/cmd/podmanV2/registry/registry.go +++ b/cmd/podmanV2/registry/registry.go @@ -9,7 +9,11 @@ import ( "github.com/spf13/cobra" ) -type CobraFuncs func(cmd *cobra.Command, args []string) error +// DefaultAPIAddress is the default address of the REST socket +const DefaultAPIAddress = "unix:/run/podman/podman.sock" + +// DefaultVarlinkAddress is the default address of the varlink socket +const DefaultVarlinkAddress = "unix:/run/podman/io.podman" type CliCommand struct { Mode []entities.EngineMode @@ -113,6 +117,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") |