summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2020-12-23 11:02:52 -0600
committerbaude <bbaude@redhat.com>2020-12-23 12:01:46 -0600
commitc81e29525b0ea84107147d92283c2b88909d1f12 (patch)
treee88e9e8d36811858ecfa026b9ed280f50ee83bae /cmd
parent54b82a175f16f27849e6791f65bf73eccae4701a (diff)
downloadpodman-c81e29525b0ea84107147d92283c2b88909d1f12.tar.gz
podman-c81e29525b0ea84107147d92283c2b88909d1f12.tar.bz2
podman-c81e29525b0ea84107147d92283c2b88909d1f12.zip
add --cidfile to container kill
Add the ability to read container ids from one or more files for the kill command. Fixes: #8443 Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/containers/kill.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/cmd/podman/containers/kill.go b/cmd/podman/containers/kill.go
index 4640229a9..28040e08a 100644
--- a/cmd/podman/containers/kill.go
+++ b/cmd/podman/containers/kill.go
@@ -5,6 +5,7 @@ import (
"errors"
"fmt"
+ "github.com/containers/common/pkg/completion"
"github.com/containers/podman/v2/cmd/podman/common"
"github.com/containers/podman/v2/cmd/podman/registry"
"github.com/containers/podman/v2/cmd/podman/utils"
@@ -22,7 +23,7 @@ var (
Long: killDescription,
RunE: kill,
Args: func(cmd *cobra.Command, args []string) error {
- return validate.CheckAllLatestAndCIDFile(cmd, args, false, false)
+ return validate.CheckAllLatestAndCIDFile(cmd, args, false, true)
},
ValidArgsFunction: common.AutocompleteContainersRunning,
Example: `podman kill mywebserver
@@ -32,7 +33,7 @@ var (
containerKillCommand = &cobra.Command{
Args: func(cmd *cobra.Command, args []string) error {
- return validate.CheckAllLatestAndCIDFile(cmd, args, false, false)
+ return validate.CheckAllLatestAndCIDFile(cmd, args, false, true)
},
Use: killCommand.Use,
Short: killCommand.Short,
@@ -57,6 +58,9 @@ func killFlags(cmd *cobra.Command) {
signalFlagName := "signal"
flags.StringVarP(&killOptions.Signal, signalFlagName, "s", "KILL", "Signal to send to the container")
_ = cmd.RegisterFlagCompletionFunc(signalFlagName, common.AutocompleteStopSignal)
+ cidfileFlagName := "cidfile"
+ flags.StringArrayVar(&killOptions.CIDFiles, cidfileFlagName, []string{}, "Read the container ID from the file")
+ _ = cmd.RegisterFlagCompletionFunc(cidfileFlagName, completion.AutocompleteDefault)
}
func init() {