diff options
Diffstat (limited to 'cmd/podmanV2')
-rw-r--r-- | cmd/podmanV2/containers/exists.go | 6 | ||||
-rw-r--r-- | cmd/podmanV2/containers/inspect.go | 2 | ||||
-rw-r--r-- | cmd/podmanV2/containers/wait.go | 22 | ||||
-rw-r--r-- | cmd/podmanV2/root.go | 2 |
4 files changed, 23 insertions, 9 deletions
diff --git a/cmd/podmanV2/containers/exists.go b/cmd/podmanV2/containers/exists.go index 93989b54a..3aff150be 100644 --- a/cmd/podmanV2/containers/exists.go +++ b/cmd/podmanV2/containers/exists.go @@ -10,7 +10,9 @@ import ( ) var ( - containerExistsCommand = &cobra.Command{ + containerExistsDescription = `If the named container exists in local storage, podman container exists exits with 0, otherwise the exit code will be 1.` + + existsCommand = &cobra.Command{ Use: "exists CONTAINER", Short: "Check if a container exists in local storage", Long: containerExistsDescription, @@ -23,7 +25,7 @@ var ( func init() { registry.Commands = append(registry.Commands, registry.CliCommand{ Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode}, - Command: containerExistsCommand, + Command: existsCommand, Parent: containerCmd, }) } diff --git a/cmd/podmanV2/containers/inspect.go b/cmd/podmanV2/containers/inspect.go index 355924984..635be4789 100644 --- a/cmd/podmanV2/containers/inspect.go +++ b/cmd/podmanV2/containers/inspect.go @@ -7,8 +7,6 @@ import ( ) var ( - containerExistsDescription = `If the named container exists in local storage, podman container exists exits with 0, otherwise the exit code will be 1.` - // podman container _inspect_ inspectCmd = &cobra.Command{ Use: "inspect [flags] CONTAINER", diff --git a/cmd/podmanV2/containers/wait.go b/cmd/podmanV2/containers/wait.go index d18064c3c..27acb3348 100644 --- a/cmd/podmanV2/containers/wait.go +++ b/cmd/podmanV2/containers/wait.go @@ -6,6 +6,7 @@ import ( "time" "github.com/containers/libpod/cmd/podmanV2/registry" + "github.com/containers/libpod/libpod/define" "github.com/containers/libpod/pkg/domain/entities" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -25,7 +26,10 @@ var ( } ) -var waitFlags = entities.WaitOptions{} +var ( + waitFlags = entities.WaitOptions{} + waitCondition string +) func init() { registry.Commands = append(registry.Commands, registry.CliCommand{ @@ -34,15 +38,20 @@ func init() { Parent: containerCmd, }) - waitCommand.SetHelpTemplate(registry.HelpTemplate()) - waitCommand.SetUsageTemplate(registry.UsageTemplate()) flags := waitCommand.Flags() flags.DurationVarP(&waitFlags.Interval, "interval", "i", time.Duration(250), "Milliseconds to wait before polling for completion") flags.BoolVarP(&waitFlags.Latest, "latest", "l", false, "Act on the latest container podman is aware of") - flags.StringVar(&waitFlags.Condition, "condition", "stopped", "Condition to wait on") + flags.StringVar(&waitCondition, "condition", "stopped", "Condition to wait on") + if registry.EngineOpts.EngineMode == entities.ABIMode { + // TODO: This is the same as V1. We could skip creating the flag altogether in V2... + _ = flags.MarkHidden("latest") + } } func wait(cmd *cobra.Command, args []string) error { + var ( + err error + ) if waitFlags.Latest && len(args) > 0 { return errors.New("cannot combine latest flag and arguments") } @@ -50,6 +59,11 @@ func wait(cmd *cobra.Command, args []string) error { return errors.New("interval must be greater then 0") } + waitFlags.Condition, err = define.StringToContainerStatus(waitCondition) + if err != nil { + return err + } + responses, err := registry.ContainerEngine().ContainerWait(context.Background(), args, waitFlags) if err != nil { return err diff --git a/cmd/podmanV2/root.go b/cmd/podmanV2/root.go index 92805ff30..24b083b9f 100644 --- a/cmd/podmanV2/root.go +++ b/cmd/podmanV2/root.go @@ -25,7 +25,7 @@ func init() { var dummyVersion bool rootCmd.PersistentFlags().BoolVarP(&dummyVersion, "version", "v", false, "Version of podman") rootCmd.PersistentFlags().StringVarP(®istry.EngineOpts.Uri, "remote", "r", "", "URL to access podman service") - rootCmd.PersistentFlags().StringSliceVarP(®istry.EngineOpts.Identities, "identity", "i", []string{}, "path to SSH identity file") + rootCmd.PersistentFlags().StringSliceVar(®istry.EngineOpts.Identities, "identity", []string{}, "path to SSH identity file") } func Execute() { |