mirror of https://github.com/containers/podman.git
Short options!
Any subcommand that has two or more booleon short options can now combine those two options. For example: kpod rmi -af (Remove all images forceably) Signed-off-by: baude <bbaude@redhat.com> Closes: #100 Approved by: rhatdan
This commit is contained in:
parent
265efcb9f8
commit
3db735c6d1
|
@ -138,6 +138,7 @@ var createCommand = cli.Command{
|
||||||
Action: createCmd,
|
Action: createCmd,
|
||||||
ArgsUsage: "IMAGE [COMMAND [ARG...]]",
|
ArgsUsage: "IMAGE [COMMAND [ARG...]]",
|
||||||
SkipArgReorder: true,
|
SkipArgReorder: true,
|
||||||
|
UseShortOptionHandling: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
func createCmd(c *cli.Context) error {
|
func createCmd(c *cli.Context) error {
|
||||||
|
|
|
@ -77,6 +77,7 @@ var (
|
||||||
Flags: historyFlags,
|
Flags: historyFlags,
|
||||||
Action: historyCmd,
|
Action: historyCmd,
|
||||||
ArgsUsage: "",
|
ArgsUsage: "",
|
||||||
|
UseShortOptionHandling: true,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,7 @@ var (
|
||||||
Flags: imagesFlags,
|
Flags: imagesFlags,
|
||||||
Action: imagesCmd,
|
Action: imagesCmd,
|
||||||
ArgsUsage: "",
|
ArgsUsage: "",
|
||||||
|
UseShortOptionHandling: true,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -139,6 +139,7 @@ var (
|
||||||
Flags: psFlags,
|
Flags: psFlags,
|
||||||
Action: psCmd,
|
Action: psCmd,
|
||||||
ArgsUsage: "",
|
ArgsUsage: "",
|
||||||
|
UseShortOptionHandling: true,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ var (
|
||||||
Flags: rmFlags,
|
Flags: rmFlags,
|
||||||
Action: rmCmd,
|
Action: rmCmd,
|
||||||
ArgsUsage: "",
|
ArgsUsage: "",
|
||||||
|
UseShortOptionHandling: true,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ var (
|
||||||
Action: rmiCmd,
|
Action: rmiCmd,
|
||||||
ArgsUsage: "IMAGE-NAME-OR-ID [...]",
|
ArgsUsage: "IMAGE-NAME-OR-ID [...]",
|
||||||
Flags: rmiFlags,
|
Flags: rmiFlags,
|
||||||
|
UseShortOptionHandling: true,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ var runCommand = cli.Command{
|
||||||
Action: runCmd,
|
Action: runCmd,
|
||||||
ArgsUsage: "IMAGE [COMMAND [ARG...]]",
|
ArgsUsage: "IMAGE [COMMAND [ARG...]]",
|
||||||
SkipArgReorder: true,
|
SkipArgReorder: true,
|
||||||
|
UseShortOptionHandling: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
func runCmd(c *cli.Context) error {
|
func runCmd(c *cli.Context) error {
|
||||||
|
|
|
@ -40,6 +40,7 @@ var (
|
||||||
Flags: startFlags,
|
Flags: startFlags,
|
||||||
Action: startCmd,
|
Action: startCmd,
|
||||||
ArgsUsage: "CONTAINER-NAME [CONTAINER-NAME ...]",
|
ArgsUsage: "CONTAINER-NAME [CONTAINER-NAME ...]",
|
||||||
|
UseShortOptionHandling: true,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -21,3 +21,9 @@ function teardown() {
|
||||||
echo "$output"
|
echo "$output"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "ensure short options" {
|
||||||
|
run ${KPOD_BINARY} ${KPOD_OPTIONS} create -dt ${BB_GLIBC} ls
|
||||||
|
echo "$output"
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
}
|
||||||
|
|
|
@ -45,3 +45,9 @@ function setup() {
|
||||||
echo "$output"
|
echo "$output"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "kpod history short options" {
|
||||||
|
run ${KPOD_BINARY} ${KPOD_OPTIONS} history -qH $ALPINE
|
||||||
|
echo "$output"
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
}
|
||||||
|
|
|
@ -40,3 +40,9 @@ function teardown() {
|
||||||
echo "$output"
|
echo "$output"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "kpod images short options" {
|
||||||
|
run ${KPOD_BINARY} ${KPOD_OPTIONS} images -qn
|
||||||
|
echo "$output"
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
}
|
||||||
|
|
|
@ -120,3 +120,12 @@ function teardown() {
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
run ${KPOD_BINARY} ${KPOD_OPTIONS} stop $ctr_id
|
run ${KPOD_BINARY} ${KPOD_OPTIONS} stop $ctr_id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "kpod ps short options" {
|
||||||
|
run ${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} sleep 99
|
||||||
|
ctr_id="$output"
|
||||||
|
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -aqs
|
||||||
|
echo "$output"
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
run ${KPOD_BINARY} ${KPOD_OPTIONS} stop $ctr_id
|
||||||
|
}
|
||||||
|
|
|
@ -60,12 +60,12 @@ function teardown() {
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "remove all containers with one running" {
|
@test "remove all containers with one running with short options" {
|
||||||
${KPOD_BINARY} ${KPOD_OPTIONS} create $BB ls
|
${KPOD_BINARY} ${KPOD_OPTIONS} create $BB ls
|
||||||
${KPOD_BINARY} ${KPOD_OPTIONS} create $BB ls -l
|
${KPOD_BINARY} ${KPOD_OPTIONS} create $BB ls -l
|
||||||
${KPOD_BINARY} ${KPOD_OPTIONS} create $BB whoami
|
${KPOD_BINARY} ${KPOD_OPTIONS} create $BB whoami
|
||||||
${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} sleep 30
|
${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} sleep 30
|
||||||
run ${KPOD_BINARY} $KPOD_OPTIONS rm -a -f
|
run ${KPOD_BINARY} $KPOD_OPTIONS rm -af
|
||||||
echo "$output"
|
echo "$output"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,10 +43,10 @@ function pullImages() {
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "kpod rmi all images forceably" {
|
@test "kpod rmi all images forceably with short options" {
|
||||||
pullImages
|
pullImages
|
||||||
${KPOD_BINARY} $KPOD_OPTIONS create ${IMAGE1} ls
|
${KPOD_BINARY} $KPOD_OPTIONS create ${IMAGE1} ls
|
||||||
run ${KPOD_BINARY} $KPOD_OPTIONS rmi -a -f
|
run ${KPOD_BINARY} $KPOD_OPTIONS rmi -af
|
||||||
echo "$output"
|
echo "$output"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,12 @@ function setup() {
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "run a container based on local image with short options" {
|
||||||
|
run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -dt $BB ls"
|
||||||
|
echo "$output"
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
}
|
||||||
|
|
||||||
@test "run a container based on a remote image" {
|
@test "run a container based on a remote image" {
|
||||||
run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run ${BB_GLIBC} ls"
|
run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run ${BB_GLIBC} ls"
|
||||||
echo "$output"
|
echo "$output"
|
||||||
|
@ -65,25 +71,22 @@ function setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "run environment test" {
|
@test "run environment test" {
|
||||||
|
run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run --env FOO=BAR ${ALPINE} printenv FOO | tr -d '\r'"
|
||||||
${KPOD_BINARY} ${KPOD_OPTIONS} pull ${ALPINE}
|
|
||||||
|
|
||||||
run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -env FOO=BAR ${ALPINE} printenv FOO | tr -d '\r'"
|
|
||||||
echo "$output"
|
echo "$output"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ $output = "BAR" ]
|
[ $output = "BAR" ]
|
||||||
|
|
||||||
run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -env PATH="/bin" ${ALPINE} printenv PATH | tr -d '\r'"
|
run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run --env PATH="/bin" ${ALPINE} printenv PATH | tr -d '\r'"
|
||||||
echo "$output"
|
echo "$output"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ $output = "/bin" ]
|
[ $output = "/bin" ]
|
||||||
|
|
||||||
run bash -c "export FOO=BAR; ${KPOD_BINARY} ${KPOD_OPTIONS} run -env FOO ${ALPINE} printenv FOO | tr -d '\r'"
|
run bash -c "export FOO=BAR; ${KPOD_BINARY} ${KPOD_OPTIONS} run --env FOO ${ALPINE} printenv FOO | tr -d '\r'"
|
||||||
echo "$output"
|
echo "$output"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "BAR" ]
|
[ "$output" = "BAR" ]
|
||||||
|
|
||||||
run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -env FOO ${ALPINE} printenv"
|
run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run --env FOO ${ALPINE} printenv"
|
||||||
echo "$output"
|
echo "$output"
|
||||||
[ "$status" -ne 0 ]
|
[ "$status" -ne 0 ]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue