summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.github/actions/check_cirrus_cron/cron_failures.sh2
-rw-r--r--cmd/podman/common/completion.go78
-rw-r--r--cmd/podman/containers/commit.go2
-rw-r--r--cmd/podman/containers/cp.go2
-rw-r--r--cmd/podman/containers/exec.go2
-rw-r--r--cmd/podman/containers/logs.go6
-rw-r--r--cmd/podman/containers/port.go2
-rw-r--r--cmd/podman/containers/prune.go2
-rw-r--r--cmd/podman/containers/runlabel.go2
-rw-r--r--cmd/podman/diff.go2
-rw-r--r--cmd/podman/generate/kube.go2
-rw-r--r--cmd/podman/generate/systemd.go2
-rw-r--r--cmd/podman/images/build.go10
-rw-r--r--cmd/podman/images/import.go5
-rw-r--r--cmd/podman/images/prune.go2
-rw-r--r--cmd/podman/images/push.go2
-rw-r--r--cmd/podman/images/save.go2
-rw-r--r--cmd/podman/images/untag.go2
-rw-r--r--cmd/podman/inspect.go4
-rw-r--r--cmd/podman/manifest/push.go2
-rw-r--r--cmd/podman/networks/create.go2
-rw-r--r--cmd/podman/play/kube.go2
-rw-r--r--cmd/podman/pods/prune.go6
-rw-r--r--cmd/podman/system/prune.go19
-rw-r--r--cmd/podman/system/service.go3
-rw-r--r--cmd/podman/system/unshare.go2
-rw-r--r--cmd/podman/utils/utils.go20
-rw-r--r--cmd/podman/volumes/prune.go2
-rw-r--r--completions/Readme.md2
-rw-r--r--docs/source/markdown/podman-generate-systemd.1.md2
-rw-r--r--docs/source/markdown/podman-network-connect.1.md2
-rw-r--r--docs/source/markdown/podman-system-prune.1.md4
-rw-r--r--docs/source/markdown/podman-system.1.md2
-rw-r--r--libpod/image/pull.go18
-rw-r--r--pkg/api/handlers/compat/containers_archive.go62
-rw-r--r--pkg/api/handlers/compat/images_build.go2
-rw-r--r--pkg/bindings/images/build.go3
-rw-r--r--pkg/copy/copy.go68
-rw-r--r--pkg/copy/fileinfo.go56
-rw-r--r--pkg/copy/item.go13
-rw-r--r--pkg/copy/parse.go61
-rw-r--r--pkg/domain/infra/abi/cp.go64
-rw-r--r--pkg/domain/infra/abi/manifest.go2
-rw-r--r--pkg/domain/infra/abi/system.go76
-rw-r--r--pkg/domain/infra/tunnel/containers.go3
-rw-r--r--pkg/specgen/generate/kube/kube.go5
-rw-r--r--pkg/specgen/generate/kube/volume.go2
-rw-r--r--test/system/015-help.bats13
-rw-r--r--test/system/070-build.bats42
-rw-r--r--test/system/600-completion.bats272
-rw-r--r--test/system/helpers.bash10
51 files changed, 748 insertions, 225 deletions
diff --git a/.github/actions/check_cirrus_cron/cron_failures.sh b/.github/actions/check_cirrus_cron/cron_failures.sh
index 2693df417..16419c6d6 100755
--- a/.github/actions/check_cirrus_cron/cron_failures.sh
+++ b/.github/actions/check_cirrus_cron/cron_failures.sh
@@ -67,7 +67,7 @@ jq --indent 4 --color-output . <./artifacts/reply.json || \
cat ./artifacts/reply.json
echo "::endgroup::"
-# Desireable to catch non-JSON encoded errors in reply.
+# Desirable to catch non-JSON encoded errors in reply.
if grep -qi 'error' ./artifacts/reply.json; then
err "Found the word 'error' in reply"
fi
diff --git a/cmd/podman/common/completion.go b/cmd/podman/common/completion.go
index 25f4d0f79..f792b2713 100644
--- a/cmd/podman/common/completion.go
+++ b/cmd/podman/common/completion.go
@@ -278,7 +278,6 @@ func validCurrentCmdLine(cmd *cobra.Command, args []string, toComplete string) b
return true
}
}
- cobra.CompDebugln(err.Error(), true)
return false
}
return true
@@ -445,6 +444,29 @@ func AutocompleteNetworks(cmd *cobra.Command, args []string, toComplete string)
return getNetworks(cmd, toComplete)
}
+// AutocompleteDefaultOneArg - Autocomplete path only for the first argument.
+func AutocompleteDefaultOneArg(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
+ if len(args) == 0 {
+ return nil, cobra.ShellCompDirectiveDefault
+ }
+ return nil, cobra.ShellCompDirectiveNoFileComp
+}
+
+// AutocompleteCommitCommand - Autocomplete podman commit command args.
+func AutocompleteCommitCommand(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
+ if !validCurrentCmdLine(cmd, args, toComplete) {
+ return nil, cobra.ShellCompDirectiveNoFileComp
+ }
+ if len(args) == 0 {
+ return getContainers(cmd, toComplete, completeDefault)
+ }
+ if len(args) == 1 {
+ return getImages(cmd, toComplete)
+ }
+ // don't complete more than 2 args
+ return nil, cobra.ShellCompDirectiveNoFileComp
+}
+
// AutocompleteCpCommand - Autocomplete podman cp command args.
func AutocompleteCpCommand(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
if !validCurrentCmdLine(cmd, args, toComplete) {
@@ -465,6 +487,43 @@ func AutocompleteCpCommand(cmd *cobra.Command, args []string, toComplete string)
return nil, cobra.ShellCompDirectiveNoFileComp
}
+// AutocompleteExecCommand - Autocomplete podman exec command args.
+func AutocompleteExecCommand(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
+ if !validCurrentCmdLine(cmd, args, toComplete) {
+ return nil, cobra.ShellCompDirectiveNoFileComp
+ }
+ if len(args) == 0 {
+ return getContainers(cmd, toComplete, completeDefault, "running")
+ }
+ return nil, cobra.ShellCompDirectiveDefault
+}
+
+// AutocompleteRunlabelCommand - Autocomplete podman container runlabel command args.
+func AutocompleteRunlabelCommand(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
+ if !validCurrentCmdLine(cmd, args, toComplete) {
+ return nil, cobra.ShellCompDirectiveNoFileComp
+ }
+ if len(args) == 0 {
+ // FIXME: What labels can we recommend here?
+ return nil, cobra.ShellCompDirectiveNoFileComp
+ }
+ if len(args) == 1 {
+ return getImages(cmd, toComplete)
+ }
+ return nil, cobra.ShellCompDirectiveDefault
+}
+
+// AutocompletePortCommand - Autocomplete podman port command args.
+func AutocompletePortCommand(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
+ if !validCurrentCmdLine(cmd, args, toComplete) {
+ return nil, cobra.ShellCompDirectiveNoFileComp
+ }
+ if len(args) == 0 {
+ return getContainers(cmd, toComplete, completeDefault)
+ }
+ return nil, cobra.ShellCompDirectiveNoFileComp
+}
+
// AutocompleteNetworkConnectCmd - Autocomplete podman network connect/disconnect command args.
func AutocompleteNetworkConnectCmd(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
if len(args) == 0 {
@@ -496,6 +555,23 @@ func AutocompleteTopCmd(cmd *cobra.Command, args []string, toComplete string) ([
return descriptors, cobra.ShellCompDirectiveNoFileComp
}
+// AutocompleteInspect - Autocomplete podman inspect.
+func AutocompleteInspect(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
+ if !validCurrentCmdLine(cmd, args, toComplete) {
+ return nil, cobra.ShellCompDirectiveNoFileComp
+ }
+ containers, _ := getContainers(cmd, toComplete, completeDefault)
+ images, _ := getImages(cmd, toComplete)
+ pods, _ := getPods(cmd, toComplete, completeDefault)
+ networks, _ := getNetworks(cmd, toComplete)
+ volumes, _ := getVolumes(cmd, toComplete)
+ suggestions := append(containers, images...)
+ suggestions = append(suggestions, pods...)
+ suggestions = append(suggestions, networks...)
+ suggestions = append(suggestions, volumes...)
+ return suggestions, cobra.ShellCompDirectiveNoFileComp
+}
+
// AutocompleteSystemConnections - Autocomplete system connections.
func AutocompleteSystemConnections(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
if !validCurrentCmdLine(cmd, args, toComplete) {
diff --git a/cmd/podman/containers/commit.go b/cmd/podman/containers/commit.go
index c5c7673b2..ff06e10f7 100644
--- a/cmd/podman/containers/commit.go
+++ b/cmd/podman/containers/commit.go
@@ -24,7 +24,7 @@ var (
Long: commitDescription,
RunE: commit,
Args: cobra.RangeArgs(1, 2),
- ValidArgsFunction: common.AutocompleteContainers,
+ ValidArgsFunction: common.AutocompleteCommitCommand,
Example: `podman commit -q --message "committing container to image" reverent_golick image-committed
podman commit -q --author "firstName lastName" reverent_golick image-committed
podman commit -q --pause=false containerID image-committed
diff --git a/cmd/podman/containers/cp.go b/cmd/podman/containers/cp.go
index fd3aa7680..9b0a01a2f 100644
--- a/cmd/podman/containers/cp.go
+++ b/cmd/podman/containers/cp.go
@@ -13,7 +13,7 @@ var (
You can copy from the container's file system to the local machine or the reverse, from the local filesystem to the container. If "-" is specified for either the SRC_PATH or DEST_PATH, you can also stream a tar archive from STDIN or to STDOUT. The CONTAINER can be a running or stopped container. The SRC_PATH or DEST_PATH can be a file or directory.
`
cpCommand = &cobra.Command{
- Use: "cp [options] SRC_PATH DEST_PATH",
+ Use: "cp [options] [CONTAINER:]SRC_PATH [CONTAINER:]DEST_PATH",
Short: "Copy files/folders between a container and the local filesystem",
Long: cpDescription,
Args: cobra.ExactArgs(2),
diff --git a/cmd/podman/containers/exec.go b/cmd/podman/containers/exec.go
index 306bae58e..3d4918d50 100644
--- a/cmd/podman/containers/exec.go
+++ b/cmd/podman/containers/exec.go
@@ -26,7 +26,7 @@ var (
Long: execDescription,
RunE: exec,
DisableFlagsInUseLine: true,
- ValidArgsFunction: common.AutocompleteContainersRunning,
+ ValidArgsFunction: common.AutocompleteExecCommand,
Example: `podman exec -it ctrID ls
podman exec -it -w /tmp myCtr pwd
podman exec --user root ctrID ls`,
diff --git a/cmd/podman/containers/logs.go b/cmd/podman/containers/logs.go
index 1fa4ac11f..d4ede370a 100644
--- a/cmd/podman/containers/logs.go
+++ b/cmd/podman/containers/logs.go
@@ -69,6 +69,12 @@ var (
)
func init() {
+ // if run remotely we only allow one container arg
+ if registry.IsRemote() {
+ logsCommand.Use = "logs [options] CONTAINER"
+ containerLogsCommand.Use = logsCommand.Use
+ }
+
// logs
registry.Commands = append(registry.Commands, registry.CliCommand{
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
diff --git a/cmd/podman/containers/port.go b/cmd/podman/containers/port.go
index ac31e158e..d59161149 100644
--- a/cmd/podman/containers/port.go
+++ b/cmd/podman/containers/port.go
@@ -26,7 +26,7 @@ var (
Args: func(cmd *cobra.Command, args []string) error {
return validate.CheckAllLatestAndCIDFile(cmd, args, true, false)
},
- ValidArgsFunction: common.AutocompleteContainers,
+ ValidArgsFunction: common.AutocompletePortCommand,
Example: `podman port --all
podman port ctrID 80/tcp
podman port --latest 80`,
diff --git a/cmd/podman/containers/prune.go b/cmd/podman/containers/prune.go
index 9ac529b1c..d3842778b 100644
--- a/cmd/podman/containers/prune.go
+++ b/cmd/podman/containers/prune.go
@@ -78,5 +78,5 @@ func prune(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
- return utils.PrintContainerPruneResults(responses)
+ return utils.PrintContainerPruneResults(responses, false)
}
diff --git a/cmd/podman/containers/runlabel.go b/cmd/podman/containers/runlabel.go
index 2f6d2eb05..6ebba4935 100644
--- a/cmd/podman/containers/runlabel.go
+++ b/cmd/podman/containers/runlabel.go
@@ -30,7 +30,7 @@ var (
Long: runlabelDescription,
RunE: runlabel,
Args: cobra.MinimumNArgs(2),
- ValidArgsFunction: common.AutocompleteImages,
+ ValidArgsFunction: common.AutocompleteRunlabelCommand,
Example: `podman container runlabel run imageID
podman container runlabel install imageID arg1 arg2
podman container runlabel --display run myImage`,
diff --git a/cmd/podman/diff.go b/cmd/podman/diff.go
index 5e6abe243..e094e6bdd 100644
--- a/cmd/podman/diff.go
+++ b/cmd/podman/diff.go
@@ -18,7 +18,7 @@ var (
// Command: podman _diff_ Object_ID
diffDescription = `Displays changes on a container or image's filesystem. The container or image will be compared to its parent layer.`
diffCmd = &cobra.Command{
- Use: "diff [options] {CONTAINER_ID | IMAGE_ID}",
+ Use: "diff [options] {CONTAINER|IMAGE}",
Args: validate.IDOrLatestArgs,
Short: "Display the changes to the object's file system",
Long: diffDescription,
diff --git a/cmd/podman/generate/kube.go b/cmd/podman/generate/kube.go
index 0517db19a..cb608e7b5 100644
--- a/cmd/podman/generate/kube.go
+++ b/cmd/podman/generate/kube.go
@@ -22,7 +22,7 @@ var (
Whether the input is for a container or pod, Podman will always generate the specification as a pod.`
kubeCmd = &cobra.Command{
- Use: "kube [options] CONTAINER... | POD",
+ Use: "kube [options] {CONTAINER...|POD}",
Short: "Generate Kubernetes YAML from a container or pod.",
Long: kubeDescription,
RunE: kube,
diff --git a/cmd/podman/generate/systemd.go b/cmd/podman/generate/systemd.go
index e9cf76aae..f9099d3b8 100644
--- a/cmd/podman/generate/systemd.go
+++ b/cmd/podman/generate/systemd.go
@@ -26,7 +26,7 @@ var (
The generated units can later be controlled via systemctl(1).`
systemdCmd = &cobra.Command{
- Use: "systemd [options] CTR|POD",
+ Use: "systemd [options] {CONTAINER|POD}",
Short: "Generate systemd units.",
Long: systemdDescription,
RunE: systemd,
diff --git a/cmd/podman/images/build.go b/cmd/podman/images/build.go
index 739e1c265..fbea1e3d8 100644
--- a/cmd/podman/images/build.go
+++ b/cmd/podman/images/build.go
@@ -11,6 +11,7 @@ import (
"github.com/containers/buildah/pkg/parse"
"github.com/containers/common/pkg/completion"
"github.com/containers/common/pkg/config"
+ "github.com/containers/podman/v2/cmd/podman/common"
"github.com/containers/podman/v2/cmd/podman/registry"
"github.com/containers/podman/v2/cmd/podman/utils"
"github.com/containers/podman/v2/pkg/domain/entities"
@@ -44,7 +45,7 @@ var (
Long: buildDescription,
Args: cobra.MaximumNArgs(1),
RunE: build,
- ValidArgsFunction: completion.AutocompleteDefault,
+ ValidArgsFunction: common.AutocompleteDefaultOneArg,
Example: `podman build .
podman build --creds=username:password -t imageName -f Containerfile.simple .
podman build --layers --force-rm --tag imageName .`,
@@ -115,6 +116,7 @@ func buildFlags(cmd *cobra.Command) {
// --layers flag
flag = layerFlags.Lookup("layers")
useLayersVal := useLayers()
+ buildOpts.Layers = useLayersVal == "true"
if err := flag.Value.Set(useLayersVal); err != nil {
logrus.Errorf("unable to set --layers to %v: %v", useLayersVal, err)
}
@@ -274,11 +276,7 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil
}
}
}
- // Check to see if the BUILDAH_LAYERS environment variable is set and
- // override command-line.
- if _, ok := os.LookupEnv("BUILDAH_LAYERS"); ok {
- flags.Layers = true
- }
+ flags.Layers = buildOpts.Layers
// `buildah bud --layers=false` acts like `docker build --squash` does.
// That is all of the new layers created during the build process are
diff --git a/cmd/podman/images/import.go b/cmd/podman/images/import.go
index f38ab3b19..ac59935ad 100644
--- a/cmd/podman/images/import.go
+++ b/cmd/podman/images/import.go
@@ -25,18 +25,19 @@ var (
Short: "Import a tarball to create a filesystem image",
Long: importDescription,
RunE: importCon,
- ValidArgsFunction: completion.AutocompleteDefault,
+ Args: cobra.RangeArgs(1, 2),
+ ValidArgsFunction: common.AutocompleteDefaultOneArg,
Example: `podman import http://example.com/ctr.tar url-image
cat ctr.tar | podman -q import --message "importing the ctr.tar tarball" - image-imported
cat ctr.tar | podman import -`,
}
imageImportCommand = &cobra.Command{
- Args: cobra.MinimumNArgs(1),
Use: importCommand.Use,
Short: importCommand.Short,
Long: importCommand.Long,
RunE: importCommand.RunE,
+ Args: importCommand.Args,
ValidArgsFunction: importCommand.ValidArgsFunction,
Example: `podman image import http://example.com/ctr.tar url-image
cat ctr.tar | podman -q image import --message "importing the ctr.tar tarball" - image-imported
diff --git a/cmd/podman/images/prune.go b/cmd/podman/images/prune.go
index e68fe5f40..268a68681 100644
--- a/cmd/podman/images/prune.go
+++ b/cmd/podman/images/prune.go
@@ -71,5 +71,5 @@ Are you sure you want to continue? [y/N] `)
return err
}
- return utils.PrintImagePruneResults(results)
+ return utils.PrintImagePruneResults(results, false)
}
diff --git a/cmd/podman/images/push.go b/cmd/podman/images/push.go
index 447b02fbe..d82083cd8 100644
--- a/cmd/podman/images/push.go
+++ b/cmd/podman/images/push.go
@@ -29,7 +29,7 @@ var (
// Command: podman push
pushCmd = &cobra.Command{
- Use: "push [options] SOURCE [DESTINATION]",
+ Use: "push [options] IMAGE [DESTINATION]",
Short: "Push an image to a specified destination",
Long: pushDescription,
RunE: imagePush,
diff --git a/cmd/podman/images/save.go b/cmd/podman/images/save.go
index 9ef2d0c91..3a35c4fad 100644
--- a/cmd/podman/images/save.go
+++ b/cmd/podman/images/save.go
@@ -43,7 +43,7 @@ var (
}
return nil
},
- ValidArgsFunction: completion.AutocompleteNone,
+ ValidArgsFunction: common.AutocompleteImages,
Example: `podman save --quiet -o myimage.tar imageID
podman save --format docker-dir -o ubuntu-dir ubuntu
podman save > alpine-all.tar alpine:latest`,
diff --git a/cmd/podman/images/untag.go b/cmd/podman/images/untag.go
index 17dc21203..3cf62713b 100644
--- a/cmd/podman/images/untag.go
+++ b/cmd/podman/images/untag.go
@@ -9,7 +9,7 @@ import (
var (
untagCommand = &cobra.Command{
- Use: "untag IMAGE [NAME...]",
+ Use: "untag IMAGE [IMAGE...]",
Short: "Remove a name from a local image",
Long: "Removes one or more names from a locally-stored image.",
RunE: untag,
diff --git a/cmd/podman/inspect.go b/cmd/podman/inspect.go
index f62abe931..64daae951 100644
--- a/cmd/podman/inspect.go
+++ b/cmd/podman/inspect.go
@@ -20,12 +20,12 @@ var (
// Command: podman _inspect_ Object_ID
inspectCmd = &cobra.Command{
- Use: "inspect [options] {CONTAINER_ID | IMAGE_ID} [...]",
+ Use: "inspect [options] {CONTAINER|IMAGE|POD|NETWORK|VOLUME} [...]",
Short: "Display the configuration of object denoted by ID",
RunE: inspectExec,
Long: inspectDescription,
TraverseChildren: true,
- ValidArgsFunction: common.AutocompleteContainersAndImages,
+ ValidArgsFunction: common.AutocompleteInspect,
Example: `podman inspect fedora
podman inspect --type image fedora
podman inspect CtrID ImgID
diff --git a/cmd/podman/manifest/push.go b/cmd/podman/manifest/push.go
index a3b469491..89faa42a2 100644
--- a/cmd/podman/manifest/push.go
+++ b/cmd/podman/manifest/push.go
@@ -24,7 +24,7 @@ type manifestPushOptsWrapper struct {
var (
manifestPushOpts = manifestPushOptsWrapper{}
pushCmd = &cobra.Command{
- Use: "push [options] SOURCE DESTINATION",
+ Use: "push [options] LIST DESTINATION",
Short: "Push a manifest list or image index to a registry",
Long: "Pushes manifest lists and image indexes to registries.",
RunE: push,
diff --git a/cmd/podman/networks/create.go b/cmd/podman/networks/create.go
index 8db4bb89a..1a091f111 100644
--- a/cmd/podman/networks/create.go
+++ b/cmd/podman/networks/create.go
@@ -17,7 +17,7 @@ import (
var (
networkCreateDescription = `create CNI networks for containers and pods`
networkCreateCommand = &cobra.Command{
- Use: "create [options] [NETWORK]",
+ Use: "create [options] [NAME]",
Short: "network create",
Long: networkCreateDescription,
RunE: networkCreate,
diff --git a/cmd/podman/play/kube.go b/cmd/podman/play/kube.go
index db70ad7d4..5e227d05a 100644
--- a/cmd/podman/play/kube.go
+++ b/cmd/podman/play/kube.go
@@ -39,7 +39,7 @@ var (
Long: kubeDescription,
RunE: kube,
Args: cobra.ExactArgs(1),
- ValidArgsFunction: completion.AutocompleteDefault,
+ ValidArgsFunction: common.AutocompleteDefaultOneArg,
Example: `podman play kube nginx.yml
podman play kube --creds user:password --seccomp-profile-root /custom/path apache.yml`,
}
diff --git a/cmd/podman/pods/prune.go b/cmd/podman/pods/prune.go
index 444b0f5e0..965c36398 100644
--- a/cmd/podman/pods/prune.go
+++ b/cmd/podman/pods/prune.go
@@ -7,7 +7,7 @@ import (
"os"
"strings"
- "github.com/containers/podman/v2/cmd/podman/common"
+ "github.com/containers/common/pkg/completion"
"github.com/containers/podman/v2/cmd/podman/registry"
"github.com/containers/podman/v2/cmd/podman/utils"
"github.com/containers/podman/v2/cmd/podman/validate"
@@ -28,7 +28,7 @@ var (
Short: "Remove all stopped pods and their containers",
Long: pruneDescription,
RunE: prune,
- ValidArgsFunction: common.AutocompletePods,
+ ValidArgsFunction: completion.AutocompleteNone,
Example: `podman pod prune`,
}
)
@@ -60,5 +60,5 @@ func prune(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
- return utils.PrintPodPruneResults(responses)
+ return utils.PrintPodPruneResults(responses, false)
}
diff --git a/cmd/podman/system/prune.go b/cmd/podman/system/prune.go
index f2b9a3db5..f57689584 100644
--- a/cmd/podman/system/prune.go
+++ b/cmd/podman/system/prune.go
@@ -73,32 +73,31 @@ Are you sure you want to continue? [y/N] `, volumeString)
return nil
}
}
+
// TODO: support for filters in system prune
response, err := registry.ContainerEngine().SystemPrune(context.Background(), pruneOptions)
if err != nil {
return err
}
- // Print pod prune results
- fmt.Println("Deleted Pods")
- err = utils.PrintPodPruneResults(response.PodPruneReport)
+ // Print container prune results
+ err = utils.PrintContainerPruneResults(response.ContainerPruneReport, true)
if err != nil {
return err
}
- // Print container prune results
- fmt.Println("Deleted Containers")
- err = utils.PrintContainerPruneResults(response.ContainerPruneReport)
+ // Print pod prune results
+ err = utils.PrintPodPruneResults(response.PodPruneReport, true)
if err != nil {
return err
}
// Print Volume prune results
if pruneOptions.Volume {
- fmt.Println("Deleted Volumes")
- err = utils.PrintVolumePruneResults(response.VolumePruneReport)
+ err = utils.PrintVolumePruneResults(response.VolumePruneReport, true)
if err != nil {
return err
}
}
// Print Images prune results
- fmt.Println("Deleted Images")
- return utils.PrintImagePruneResults(response.ImagePruneReport)
+ utils.PrintImagePruneResults(response.ImagePruneReport, true)
+
+ return nil
}
diff --git a/cmd/podman/system/service.go b/cmd/podman/system/service.go
index 42482b5d9..f8bdbfa10 100644
--- a/cmd/podman/system/service.go
+++ b/cmd/podman/system/service.go
@@ -10,6 +10,7 @@ import (
"time"
"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/pkg/domain/entities"
"github.com/containers/podman/v2/pkg/rootless"
@@ -32,7 +33,7 @@ Enable a listening service for API access to Podman commands.
Short: "Run API service",
Long: srvDescription,
RunE: service,
- ValidArgsFunction: completion.AutocompleteDefault,
+ ValidArgsFunction: common.AutocompleteDefaultOneArg,
Example: `podman system service --time=0 unix:///tmp/podman.sock`,
}
diff --git a/cmd/podman/system/unshare.go b/cmd/podman/system/unshare.go
index 437cf7b2e..364852979 100644
--- a/cmd/podman/system/unshare.go
+++ b/cmd/podman/system/unshare.go
@@ -14,7 +14,7 @@ import (
var (
unshareDescription = "Runs a command in a modified user namespace."
unshareCommand = &cobra.Command{
- Use: "unshare [COMMAND [ARG ...]]",
+ Use: "unshare [COMMAND [ARG...]]",
DisableFlagsInUseLine: true,
Short: "Run a command in a modified user namespace",
Long: unshareDescription,
diff --git a/cmd/podman/utils/utils.go b/cmd/podman/utils/utils.go
index 1c9e4d786..2ca2c4c92 100644
--- a/cmd/podman/utils/utils.go
+++ b/cmd/podman/utils/utils.go
@@ -26,8 +26,11 @@ func FileExists(path string) bool {
return !file.IsDir()
}
-func PrintPodPruneResults(podPruneReports []*entities.PodPruneReport) error {
+func PrintPodPruneResults(podPruneReports []*entities.PodPruneReport, heading bool) error {
var errs OutputErrors
+ if heading && len(podPruneReports) > 0 {
+ fmt.Println("Deleted Pods")
+ }
for _, r := range podPruneReports {
if r.Err == nil {
fmt.Println(r.Id)
@@ -38,8 +41,11 @@ func PrintPodPruneResults(podPruneReports []*entities.PodPruneReport) error {
return errs.PrintErrors()
}
-func PrintContainerPruneResults(containerPruneReport *entities.ContainerPruneReport) error {
+func PrintContainerPruneResults(containerPruneReport *entities.ContainerPruneReport, heading bool) error {
var errs OutputErrors
+ if heading && (len(containerPruneReport.ID) > 0 || len(containerPruneReport.Err) > 0) {
+ fmt.Println("Deleted Containers")
+ }
for k := range containerPruneReport.ID {
fmt.Println(k)
}
@@ -49,8 +55,11 @@ func PrintContainerPruneResults(containerPruneReport *entities.ContainerPruneRep
return errs.PrintErrors()
}
-func PrintVolumePruneResults(volumePruneReport []*entities.VolumePruneReport) error {
+func PrintVolumePruneResults(volumePruneReport []*entities.VolumePruneReport, heading bool) error {
var errs OutputErrors
+ if heading && len(volumePruneReport) > 0 {
+ fmt.Println("Deleted Volumes")
+ }
for _, r := range volumePruneReport {
if r.Err == nil {
fmt.Println(r.Id)
@@ -61,7 +70,10 @@ func PrintVolumePruneResults(volumePruneReport []*entities.VolumePruneReport) er
return errs.PrintErrors()
}
-func PrintImagePruneResults(imagePruneReport *entities.ImagePruneReport) error {
+func PrintImagePruneResults(imagePruneReport *entities.ImagePruneReport, heading bool) error {
+ if heading && (len(imagePruneReport.Report.Id) > 0 || len(imagePruneReport.Report.Err) > 0) {
+ fmt.Println("Deleted Images")
+ }
for _, i := range imagePruneReport.Report.Id {
fmt.Println(i)
}
diff --git a/cmd/podman/volumes/prune.go b/cmd/podman/volumes/prune.go
index 4c2136dcf..d1370120b 100644
--- a/cmd/podman/volumes/prune.go
+++ b/cmd/podman/volumes/prune.go
@@ -62,5 +62,5 @@ func prune(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
- return utils.PrintVolumePruneResults(responses)
+ return utils.PrintVolumePruneResults(responses, false)
}
diff --git a/completions/Readme.md b/completions/Readme.md
index 9a3eac480..5c9d16f3c 100644
--- a/completions/Readme.md
+++ b/completions/Readme.md
@@ -4,4 +4,4 @@ Podman offers shell completion scripts for bash, zsh and fish. The completion sc
The shell completion scripts are generated by `make completion`, do not edit these files directly. To install them you can run `sudo make install.completions`.
-For information about these sripts see [`man podman-completion`](../docs/source/markdown/podman-completion.1.md)
+For information about these scripts see [`man podman-completion`](../docs/source/markdown/podman-completion.1.md)
diff --git a/docs/source/markdown/podman-generate-systemd.1.md b/docs/source/markdown/podman-generate-systemd.1.md
index 445888d30..032158c56 100644
--- a/docs/source/markdown/podman-generate-systemd.1.md
+++ b/docs/source/markdown/podman-generate-systemd.1.md
@@ -155,7 +155,7 @@ Podman-generated unit files include an `[Install]` section, which carries instal
Once you have generated the systemd unit file, you can copy the generated systemd file to ```/etc/systemd/system``` for installing as a root user and to ```$HOME/.config/systemd/user``` for installing it as a non-root user. Enable the copied unit file or files using `systemctl enable`.
-Note: Coping unit files to ```/etc/systemd/system``` and enabling it marks the unit file to be automatically started at boot. And smillarly, coping a unit file to ```$HOME/.config/systemd/user``` and enabling it marks the unit file to be automatically started on user login.
+Note: Copying unit files to ```/etc/systemd/system``` and enabling it marks the unit file to be automatically started at boot. And similarly, copying a unit file to ```$HOME/.config/systemd/user``` and enabling it marks the unit file to be automatically started on user login.
```
diff --git a/docs/source/markdown/podman-network-connect.1.md b/docs/source/markdown/podman-network-connect.1.md
index a31a415dc..cff4336d6 100644
--- a/docs/source/markdown/podman-network-connect.1.md
+++ b/docs/source/markdown/podman-network-connect.1.md
@@ -15,7 +15,7 @@ This command is not available for rootless users.
## OPTIONS
#### **--alias**
Add network-scoped alias for the container. If the network is using the `dnsname` CNI plugin, these aliases
-can be used for name resolution on the given network. Multiple *--alias* options may be specificed as input.
+can be used for name resolution on the given network. Multiple *--alias* options may be specified as input.
## EXAMPLE
diff --git a/docs/source/markdown/podman-system-prune.1.md b/docs/source/markdown/podman-system-prune.1.md
index 9a078648b..431a11267 100644
--- a/docs/source/markdown/podman-system-prune.1.md
+++ b/docs/source/markdown/podman-system-prune.1.md
@@ -1,7 +1,7 @@
% podman-system-prune(1)
## NAME
-podman\-system\-prune - Remove all unused container, image and volume data
+podman\-system\-prune - Remove all unused pod, container, image and volume data
## SYNOPSIS
**podman system prune** [*options*]
@@ -16,7 +16,7 @@ By default, volumes are not removed to prevent important data from being deleted
## OPTIONS
#### **--all**, **-a**
-Remove all unused images not just dangling ones.
+Recursively remove all unused pod, container, image and volume data (Maximum 50 iterations.)
#### **--force**, **-f**
diff --git a/docs/source/markdown/podman-system.1.md b/docs/source/markdown/podman-system.1.md
index 9ac73237e..7b9081b84 100644
--- a/docs/source/markdown/podman-system.1.md
+++ b/docs/source/markdown/podman-system.1.md
@@ -17,7 +17,7 @@ The system command allows you to manage the podman systems
| df | [podman-system-df(1)](podman-system-df.1.md) | Show podman disk usage. |
| info | [podman-system-info(1)](podman-info.1.md) | Displays Podman related system information. |
| migrate | [podman-system-migrate(1)](podman-system-migrate.1.md) | Migrate existing containers to a new podman version. |
-| prune | [podman-system-prune(1)](podman-system-prune.1.md) | Remove all unused container, image and volume data. |
+| prune | [podman-system-prune(1)](podman-system-prune.1.md) | Remove all unused pod, container, image and volume data. |
| renumber | [podman-system-renumber(1)](podman-system-renumber.1.md) | Migrate lock numbers to handle a change in maximum number of locks. |
| reset | [podman-system-reset(1)](podman-system-reset.1.md) | Reset storage back to initial state. |
| service | [podman-system-service(1)](podman-system-service.1.md) | Run an API service |
diff --git a/libpod/image/pull.go b/libpod/image/pull.go
index 2a2d16252..c37929927 100644
--- a/libpod/image/pull.go
+++ b/libpod/image/pull.go
@@ -4,7 +4,6 @@ import (
"context"
"fmt"
"io"
- "os"
"path/filepath"
"strings"
@@ -378,29 +377,12 @@ func (ir *Runtime) doPullImage(ctx context.Context, sc *types.SystemContext, goa
return images, nil
}
-// getShortNameMode looks up the `CONTAINERS_SHORT_NAME_ALIASING` environment
-// variable. If it's "on", return `nil` to use the defaults from
-// containers/image and the registries.conf files on the system. If it's
-// "off", empty or unset, return types.ShortNameModeDisabled to turn off
-// short-name aliasing by default.
-//
-// TODO: remove this function once we want to default to short-name aliasing.
-func getShortNameMode() *types.ShortNameMode {
- env := os.Getenv("CONTAINERS_SHORT_NAME_ALIASING")
- if strings.ToLower(env) == "on" {
- return nil // default to whatever registries.conf and c/image decide
- }
- mode := types.ShortNameModeDisabled
- return &mode
-}
-
// pullGoalFromPossiblyUnqualifiedName looks at inputName and determines the possible
// image references to try pulling in combination with the registries.conf file as well
func (ir *Runtime) pullGoalFromPossiblyUnqualifiedName(sys *types.SystemContext, writer io.Writer, inputName string) (*pullGoal, error) {
if sys == nil {
sys = &types.SystemContext{}
}
- sys.ShortNameMode = getShortNameMode()
resolved, err := shortnames.Resolve(sys, inputName)
if err != nil {
diff --git a/pkg/api/handlers/compat/containers_archive.go b/pkg/api/handlers/compat/containers_archive.go
index 223eb2cd5..d8197415c 100644
--- a/pkg/api/handlers/compat/containers_archive.go
+++ b/pkg/api/handlers/compat/containers_archive.go
@@ -1,13 +1,8 @@
package compat
import (
- "bytes"
- "encoding/base64"
- "encoding/json"
"fmt"
"net/http"
- "os"
- "time"
"github.com/containers/podman/v2/libpod"
"github.com/containers/podman/v2/libpod/define"
@@ -15,6 +10,7 @@ import (
"github.com/containers/podman/v2/pkg/copy"
"github.com/gorilla/schema"
"github.com/pkg/errors"
+ "github.com/sirupsen/logrus"
)
func Archive(w http.ResponseWriter, r *http.Request) {
@@ -71,12 +67,12 @@ func handleHeadAndGet(w http.ResponseWriter, r *http.Request, decoder *schema.De
utils.Error(w, "Not found.", http.StatusNotFound, errors.Wrapf(err, "error stating container path %q", query.Path))
return
}
- statHeader, err := fileInfoToDockerStats(info)
+ statHeader, err := copy.EncodeFileInfo(info)
if err != nil {
utils.Error(w, "Something went wrong", http.StatusInternalServerError, err)
return
}
- w.Header().Add("X-Docker-Container-Path-Stat", statHeader)
+ w.Header().Add(copy.XDockerContainerPathStatHeader, statHeader)
// Our work is done when the user is interested in the header only.
if r.Method == http.MethodHead {
@@ -91,47 +87,16 @@ func handleHeadAndGet(w http.ResponseWriter, r *http.Request, decoder *schema.De
return
}
- w.WriteHeader(http.StatusOK)
- if err := copy.Copy(&source, &destination, false); err != nil {
+ copier, err := copy.GetCopier(&source, &destination, false)
+ if err != nil {
utils.Error(w, "Something went wrong", http.StatusInternalServerError, err)
return
}
-}
-
-func fileInfoToDockerStats(info *copy.FileInfo) (string, error) {
- dockerStats := struct {
- Name string `json:"name"`
- Size int64 `json:"size"`
- Mode os.FileMode `json:"mode"`
- ModTime time.Time `json:"mtime"`
- LinkTarget string `json:"linkTarget"`
- }{
- Name: info.Name,
- Size: info.Size,
- Mode: info.Mode,
- ModTime: info.ModTime,
- LinkTarget: info.LinkTarget,
- }
-
- jsonBytes, err := json.Marshal(&dockerStats)
- if err != nil {
- return "", errors.Wrap(err, "failed to serialize file stats")
- }
-
- buff := bytes.NewBuffer(make([]byte, 0, 128))
- base64encoder := base64.NewEncoder(base64.StdEncoding, buff)
-
- _, err = base64encoder.Write(jsonBytes)
- if err != nil {
- return "", err
- }
-
- err = base64encoder.Close()
- if err != nil {
- return "", err
+ w.WriteHeader(http.StatusOK)
+ if err := copier.Copy(); err != nil {
+ logrus.Errorf("Error during copy: %v", err)
+ return
}
-
- return buff.String(), nil
}
func handlePut(w http.ResponseWriter, r *http.Request, decoder *schema.Decoder, runtime *libpod.Runtime) {
@@ -170,9 +135,14 @@ func handlePut(w http.ResponseWriter, r *http.Request, decoder *schema.Decoder,
return
}
- w.WriteHeader(http.StatusOK)
- if err := copy.Copy(&source, &destination, false); err != nil {
+ copier, err := copy.GetCopier(&source, &destination, false)
+ if err != nil {
utils.Error(w, "Something went wrong", http.StatusInternalServerError, err)
return
}
+ w.WriteHeader(http.StatusOK)
+ if err := copier.Copy(); err != nil {
+ logrus.Errorf("Error during copy: %v", err)
+ return
+ }
}
diff --git a/pkg/api/handlers/compat/images_build.go b/pkg/api/handlers/compat/images_build.go
index 43478c1d3..415ff85cd 100644
--- a/pkg/api/handlers/compat/images_build.go
+++ b/pkg/api/handlers/compat/images_build.go
@@ -71,6 +71,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
ForceRm bool `schema:"forcerm"`
HTTPProxy bool `schema:"httpproxy"`
Labels string `schema:"labels"`
+ Layers bool `schema:"layers"`
MemSwap int64 `schema:"memswap"`
Memory int64 `schema:"memory"`
NetworkMode string `schema:"networkmode"`
@@ -165,6 +166,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
Registry: query.Registry,
IgnoreUnrecognizedInstructions: true,
Quiet: query.Quiet,
+ Layers: query.Layers,
Isolation: buildah.IsolationChroot,
Compression: archive.Gzip,
Args: buildArgs,
diff --git a/pkg/bindings/images/build.go b/pkg/bindings/images/build.go
index 815ab4e86..d34ab87d9 100644
--- a/pkg/bindings/images/build.go
+++ b/pkg/bindings/images/build.go
@@ -41,6 +41,9 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
if options.NoCache {
params.Set("nocache", "1")
}
+ if options.Layers {
+ params.Set("layers", "1")
+ }
// TODO cachefrom
if options.PullPolicy == buildah.PullAlways {
params.Set("pull", "1")
diff --git a/pkg/copy/copy.go b/pkg/copy/copy.go
index 0e68eb450..13893deb2 100644
--- a/pkg/copy/copy.go
+++ b/pkg/copy/copy.go
@@ -25,31 +25,61 @@ import (
//
// ****************************************************************************
-// Copy the source item to destination. Use extract to untar the source if
-// it's a tar archive.
-func Copy(source *CopyItem, destination *CopyItem, extract bool) error {
+// Copier copies data from a source to a destination CopyItem.
+type Copier struct {
+ copyFunc func() error
+ cleanUpFuncs []deferFunc
+}
+
+// cleanUp releases resources the Copier may hold open.
+func (c *Copier) cleanUp() {
+ for _, f := range c.cleanUpFuncs {
+ f()
+ }
+}
+
+// Copy data from a source to a destination CopyItem.
+func (c *Copier) Copy() error {
+ defer c.cleanUp()
+ return c.copyFunc()
+}
+
+// GetCopiers returns a Copier to copy the source item to destination. Use
+// extract to untar the source if it's a tar archive.
+func GetCopier(source *CopyItem, destination *CopyItem, extract bool) (*Copier, error) {
+ copier := &Copier{}
+
// First, do the man-page dance. See podman-cp(1) for details.
if err := enforceCopyRules(source, destination); err != nil {
- return err
+ return nil, err
}
// Destination is a stream (e.g., stdout or an http body).
if destination.info.IsStream {
// Source is a stream (e.g., stdin or an http body).
if source.info.IsStream {
- _, err := io.Copy(destination.writer, source.reader)
- return err
+ copier.copyFunc = func() error {
+ _, err := io.Copy(destination.writer, source.reader)
+ return err
+ }
+ return copier, nil
}
root, glob, err := source.buildahGlobs()
if err != nil {
- return err
+ return nil, err
}
- return buildahCopiah.Get(root, "", source.getOptions(), []string{glob}, destination.writer)
+ copier.copyFunc = func() error {
+ return buildahCopiah.Get(root, "", source.getOptions(), []string{glob}, destination.writer)
+ }
+ return copier, nil
}
// Destination is either a file or a directory.
if source.info.IsStream {
- return buildahCopiah.Put(destination.root, destination.resolved, source.putOptions(), source.reader)
+ copier.copyFunc = func() error {
+ return buildahCopiah.Put(destination.root, destination.resolved, source.putOptions(), source.reader)
+ }
+ return copier, nil
}
tarOptions := &archive.TarOptions{
@@ -71,33 +101,36 @@ func Copy(source *CopyItem, destination *CopyItem, extract bool) error {
var tarReader io.ReadCloser
if extract && archive.IsArchivePath(source.resolved) {
if !destination.info.IsDir {
- return errors.Errorf("cannot extract archive %q to file %q", source.original, destination.original)
+ return nil, errors.Errorf("cannot extract archive %q to file %q", source.original, destination.original)
}
reader, err := os.Open(source.resolved)
if err != nil {
- return err
+ return nil, err
}
- defer reader.Close()
+ copier.cleanUpFuncs = append(copier.cleanUpFuncs, func() { reader.Close() })
// The stream from stdin may be compressed (e.g., via gzip).
decompressedStream, err := archive.DecompressStream(reader)
if err != nil {
- return err
+ return nil, err
}
- defer decompressedStream.Close()
+ copier.cleanUpFuncs = append(copier.cleanUpFuncs, func() { decompressedStream.Close() })
tarReader = decompressedStream
} else {
reader, err := archive.TarWithOptions(source.resolved, tarOptions)
if err != nil {
- return err
+ return nil, err
}
- defer reader.Close()
+ copier.cleanUpFuncs = append(copier.cleanUpFuncs, func() { reader.Close() })
tarReader = reader
}
- return buildahCopiah.Put(root, dir, source.putOptions(), tarReader)
+ copier.copyFunc = func() error {
+ return buildahCopiah.Put(root, dir, source.putOptions(), tarReader)
+ }
+ return copier, nil
}
// enforceCopyRules enforces the rules for copying from a source to a
@@ -114,7 +147,6 @@ func enforceCopyRules(source, destination *CopyItem) error {
return nil
}
- // Source is a *stream*.
if source.info.IsStream {
if !(destination.info.IsDir || destination.info.IsStream) {
return errors.New("destination must be a directory or stream when copying from a stream")
diff --git a/pkg/copy/fileinfo.go b/pkg/copy/fileinfo.go
new file mode 100644
index 000000000..08b4eb377
--- /dev/null
+++ b/pkg/copy/fileinfo.go
@@ -0,0 +1,56 @@
+package copy
+
+import (
+ "encoding/base64"
+ "encoding/json"
+ "net/http"
+ "os"
+ "strings"
+ "time"
+
+ "github.com/pkg/errors"
+)
+
+// XDockerContainerPathStatHeader is the *key* in http headers pointing to the
+// base64 encoded JSON payload of stating a path in a container.
+const XDockerContainerPathStatHeader = "X-Docker-Container-Path-Stat"
+
+// FileInfo describes a file or directory and is returned by
+// (*CopyItem).Stat().
+type FileInfo struct {
+ Name string `json:"name"`
+ Size int64 `json:"size"`
+ Mode os.FileMode `json:"mode"`
+ ModTime time.Time `json:"mtime"`
+ IsDir bool `json:"isDir"`
+ IsStream bool `json:"isStream"`
+ LinkTarget string `json:"linkTarget"`
+}
+
+// EncodeFileInfo serializes the specified FileInfo as a base64 encoded JSON
+// payload. Intended for Docker compat.
+func EncodeFileInfo(info *FileInfo) (string, error) {
+ buf, err := json.Marshal(&info)
+ if err != nil {
+ return "", errors.Wrap(err, "failed to serialize file stats")
+ }
+ return base64.URLEncoding.EncodeToString(buf), nil
+}
+
+// ExtractFileInfoFromHeader extracts a base64 encoded JSON payload of a
+// FileInfo in the http header. If no such header entry is found, nil is
+// returned. Intended for Docker compat.
+func ExtractFileInfoFromHeader(header *http.Header) (*FileInfo, error) {
+ rawData := header.Get(XDockerContainerPathStatHeader)
+ if len(rawData) == 0 {
+ return nil, nil
+ }
+
+ info := FileInfo{}
+ base64Decoder := base64.NewDecoder(base64.URLEncoding, strings.NewReader(rawData))
+ if err := json.NewDecoder(base64Decoder).Decode(&info); err != nil {
+ return nil, err
+ }
+
+ return &info, nil
+}
diff --git a/pkg/copy/item.go b/pkg/copy/item.go
index db6bca610..df8bf30b9 100644
--- a/pkg/copy/item.go
+++ b/pkg/copy/item.go
@@ -5,7 +5,6 @@ import (
"os"
"path/filepath"
"strings"
- "time"
buildahCopiah "github.com/containers/buildah/copier"
"github.com/containers/buildah/pkg/chrootuser"
@@ -75,18 +74,6 @@ type CopyItem struct {
// deferFunc allows for returning functions that must be deferred at call sites.
type deferFunc func()
-// FileInfo describes a file or directory and is returned by
-// (*CopyItem).Stat().
-type FileInfo struct {
- Name string `json:"name"`
- Size int64 `json:"size"`
- Mode os.FileMode `json:"mode"`
- ModTime time.Time `json:"mtime"`
- IsDir bool `json:"isDir"`
- IsStream bool `json:"isStream"`
- LinkTarget string `json:"linkTarget"`
-}
-
// Stat returns the FileInfo.
func (item *CopyItem) Stat() (*FileInfo, error) {
return &item.info, item.statError
diff --git a/pkg/copy/parse.go b/pkg/copy/parse.go
new file mode 100644
index 000000000..39e0e1547
--- /dev/null
+++ b/pkg/copy/parse.go
@@ -0,0 +1,61 @@
+package copy
+
+import (
+ "strings"
+
+ "github.com/pkg/errors"
+)
+
+// ParseSourceAndDestination parses the source and destination input into a
+// possibly specified container and path. The input format is described in
+// podman-cp(1) as "[nameOrID:]path". Colons in paths are supported as long
+// they start with a dot or slash.
+//
+// It returns, in order, the source container and path, followed by the
+// destination container and path, and an error. Note that exactly one
+// container must be specified.
+func ParseSourceAndDestination(source, destination string) (string, string, string, string, error) {
+ sourceContainer, sourcePath := parseUserInput(source)
+ destContainer, destPath := parseUserInput(destination)
+
+ numContainers := 0
+ if len(sourceContainer) > 0 {
+ numContainers++
+ }
+ if len(destContainer) > 0 {
+ numContainers++
+ }
+
+ if numContainers != 1 {
+ return "", "", "", "", errors.Errorf("invalid arguments %q, %q: exactly 1 container expected but %d specified", source, destination, numContainers)
+ }
+
+ if len(sourcePath) == 0 || len(destPath) == 0 {
+ return "", "", "", "", errors.Errorf("invalid arguments %q, %q: you must specify paths", source, destination)
+ }
+
+ return sourceContainer, sourcePath, destContainer, destPath, nil
+}
+
+// parseUserInput parses the input string and returns, if specified, the name
+// or ID of the container and the path. The input format is described in
+// podman-cp(1) as "[nameOrID:]path". Colons in paths are supported as long
+// they start with a dot or slash.
+func parseUserInput(input string) (container string, path string) {
+ if len(input) == 0 {
+ return
+ }
+ path = input
+
+ // If the input starts with a dot or slash, it cannot refer to a
+ // container.
+ if input[0] == '.' || input[0] == '/' {
+ return
+ }
+
+ if spl := strings.SplitN(path, ":", 2); len(spl) == 2 {
+ container = spl[0]
+ path = spl[1]
+ }
+ return
+}
diff --git a/pkg/domain/infra/abi/cp.go b/pkg/domain/infra/abi/cp.go
index 9409df743..362053cce 100644
--- a/pkg/domain/infra/abi/cp.go
+++ b/pkg/domain/infra/abi/cp.go
@@ -2,46 +2,53 @@ package abi
import (
"context"
- "strings"
"github.com/containers/podman/v2/libpod"
"github.com/containers/podman/v2/pkg/copy"
"github.com/containers/podman/v2/pkg/domain/entities"
- "github.com/pkg/errors"
)
func (ic *ContainerEngine) ContainerCp(ctx context.Context, source, dest string, options entities.ContainerCpOptions) error {
- srcCtr, srcPath := parsePath(ic.Libpod, source)
- destCtr, destPath := parsePath(ic.Libpod, dest)
-
- if srcCtr != nil && destCtr != nil {
- return errors.Errorf("invalid arguments %q, %q: you must use just one container", source, dest)
+ // Parse user input.
+ sourceContainerStr, sourcePath, destContainerStr, destPath, err := copy.ParseSourceAndDestination(source, dest)
+ if err != nil {
+ return err
}
- if srcCtr == nil && destCtr == nil {
- return errors.Errorf("invalid arguments %q, %q: you must specify one container", source, dest)
+
+ // Look up containers.
+ var sourceContainer, destContainer *libpod.Container
+ if len(sourceContainerStr) > 0 {
+ sourceContainer, err = ic.Libpod.LookupContainer(sourceContainerStr)
+ if err != nil {
+ return err
+ }
}
- if len(srcPath) == 0 || len(destPath) == 0 {
- return errors.Errorf("invalid arguments %q, %q: you must specify paths", source, dest)
+ if len(destContainerStr) > 0 {
+ destContainer, err = ic.Libpod.LookupContainer(destContainerStr)
+ if err != nil {
+ return err
+ }
}
var sourceItem, destinationItem copy.CopyItem
- var err error
- // Copy from the container to the host.
- if srcCtr != nil {
- sourceItem, err = copy.CopyItemForContainer(srcCtr, srcPath, options.Pause, true)
+
+ // Source ... container OR host.
+ if sourceContainer != nil {
+ sourceItem, err = copy.CopyItemForContainer(sourceContainer, sourcePath, options.Pause, true)
defer sourceItem.CleanUp()
if err != nil {
return err
}
} else {
- sourceItem, err = copy.CopyItemForHost(srcPath, true)
+ sourceItem, err = copy.CopyItemForHost(sourcePath, true)
if err != nil {
return err
}
}
- if destCtr != nil {
- destinationItem, err = copy.CopyItemForContainer(destCtr, destPath, options.Pause, false)
+ // Destination ... container OR host.
+ if destContainer != nil {
+ destinationItem, err = copy.CopyItemForContainer(destContainer, destPath, options.Pause, false)
defer destinationItem.CleanUp()
if err != nil {
return err
@@ -55,22 +62,9 @@ func (ic *ContainerEngine) ContainerCp(ctx context.Context, source, dest string,
}
// Copy from the host to the container.
- return copy.Copy(&sourceItem, &destinationItem, options.Extract)
-}
-
-func parsePath(runtime *libpod.Runtime, path string) (*libpod.Container, string) {
- if len(path) == 0 {
- return nil, ""
- }
- if path[0] == '.' || path[0] == '/' { // A path cannot point to a container.
- return nil, path
- }
- pathArr := strings.SplitN(path, ":", 2)
- if len(pathArr) == 2 {
- ctr, err := runtime.LookupContainer(pathArr[0])
- if err == nil {
- return ctr, pathArr[1]
- }
+ copier, err := copy.GetCopier(&sourceItem, &destinationItem, options.Extract)
+ if err != nil {
+ return err
}
- return nil, path
+ return copier.Copy()
}
diff --git a/pkg/domain/infra/abi/manifest.go b/pkg/domain/infra/abi/manifest.go
index ad7128b42..600d64b1d 100644
--- a/pkg/domain/infra/abi/manifest.go
+++ b/pkg/domain/infra/abi/manifest.go
@@ -54,7 +54,7 @@ func (ir *ImageEngine) ManifestInspect(ctx context.Context, name string) ([]byte
}
return buf, nil
// no return if local image is not a list of images type
- // continue on getting valid manifest through remote serice
+ // continue on getting valid manifest through remote service
} else if errors.Cause(err) != buildahManifests.ErrManifestTypeNotSupported {
return nil, errors.Wrapf(err, "loading manifest %q", name)
}
diff --git a/pkg/domain/infra/abi/system.go b/pkg/domain/infra/abi/system.go
index ec2532bea..7ed58092b 100644
--- a/pkg/domain/infra/abi/system.go
+++ b/pkg/domain/infra/abi/system.go
@@ -168,37 +168,61 @@ func checkInput() error { // nolint:deadcode,unused
// SystemPrune removes unused data from the system. Pruning pods, containers, volumes and images.
func (ic *ContainerEngine) SystemPrune(ctx context.Context, options entities.SystemPruneOptions) (*entities.SystemPruneReport, error) {
var systemPruneReport = new(entities.SystemPruneReport)
- podPruneReport, err := ic.prunePodHelper(ctx)
- if err != nil {
- return nil, err
- }
- systemPruneReport.PodPruneReport = podPruneReport
-
- containerPruneReport, err := ic.pruneContainersHelper(nil)
- if err != nil {
- return nil, err
- }
- systemPruneReport.ContainerPruneReport = containerPruneReport
-
- results, err := ic.Libpod.ImageRuntime().PruneImages(ctx, options.All, nil)
- if err != nil {
- return nil, err
- }
- report := entities.ImagePruneReport{
- Report: entities.Report{
- Id: results,
- Err: nil,
- },
- }
+ found := true
+ for found {
+ found = false
+ podPruneReport, err := ic.prunePodHelper(ctx)
+ if err != nil {
+ return nil, err
+ }
+ if len(podPruneReport) > 0 {
+ found = true
+ }
+ systemPruneReport.PodPruneReport = append(systemPruneReport.PodPruneReport, podPruneReport...)
+ containerPruneReport, err := ic.pruneContainersHelper(nil)
+ if err != nil {
+ return nil, err
+ }
+ if len(containerPruneReport.ID) > 0 {
+ found = true
+ }
+ if systemPruneReport.ContainerPruneReport == nil {
+ systemPruneReport.ContainerPruneReport = containerPruneReport
+ } else {
+ for name, val := range containerPruneReport.ID {
+ systemPruneReport.ContainerPruneReport.ID[name] = val
+ }
+ }
- systemPruneReport.ImagePruneReport = &report
+ results, err := ic.Libpod.ImageRuntime().PruneImages(ctx, options.All, nil)
- if options.Volume {
- volumePruneReport, err := ic.pruneVolumesHelper(ctx)
if err != nil {
return nil, err
}
- systemPruneReport.VolumePruneReport = volumePruneReport
+ if len(results) > 0 {
+ found = true
+ }
+
+ if systemPruneReport.ImagePruneReport == nil {
+ systemPruneReport.ImagePruneReport = &entities.ImagePruneReport{
+ Report: entities.Report{
+ Id: results,
+ Err: nil,
+ },
+ }
+ } else {
+ systemPruneReport.ImagePruneReport.Report.Id = append(systemPruneReport.ImagePruneReport.Report.Id, results...)
+ }
+ if options.Volume {
+ volumePruneReport, err := ic.pruneVolumesHelper(ctx)
+ if err != nil {
+ return nil, err
+ }
+ if len(volumePruneReport) > 0 {
+ found = true
+ }
+ systemPruneReport.VolumePruneReport = append(systemPruneReport.VolumePruneReport, volumePruneReport...)
+ }
}
return systemPruneReport, nil
}
diff --git a/pkg/domain/infra/tunnel/containers.go b/pkg/domain/infra/tunnel/containers.go
index 3584668c7..e65fef0a4 100644
--- a/pkg/domain/infra/tunnel/containers.go
+++ b/pkg/domain/infra/tunnel/containers.go
@@ -732,7 +732,8 @@ func (ic *ContainerEngine) ContainerPort(ctx context.Context, nameOrID string, o
}
func (ic *ContainerEngine) ContainerCp(ctx context.Context, source, dest string, options entities.ContainerCpOptions) error {
- return errors.New("not implemented")
+ return nil
+ // return containers.Copy(ic.ClientCxt, source, dest, options)
}
// Shutdown Libpod engine
diff --git a/pkg/specgen/generate/kube/kube.go b/pkg/specgen/generate/kube/kube.go
index 5f72d28bb..5cc7891ac 100644
--- a/pkg/specgen/generate/kube/kube.go
+++ b/pkg/specgen/generate/kube/kube.go
@@ -148,6 +148,11 @@ func ToSpecGen(ctx context.Context, containerYAML v1.Container, iid string, newI
// Environment Variables
envs := map[string]string{}
+ for _, env := range imageData.Config.Env {
+ keyval := strings.Split(env, "=")
+ envs[keyval[0]] = keyval[1]
+ }
+
for _, env := range containerYAML.Env {
value := envVarValue(env, configMaps)
diff --git a/pkg/specgen/generate/kube/volume.go b/pkg/specgen/generate/kube/volume.go
index 2ef0f4c23..bb8edabb7 100644
--- a/pkg/specgen/generate/kube/volume.go
+++ b/pkg/specgen/generate/kube/volume.go
@@ -103,7 +103,7 @@ func VolumeFromSource(volumeSource v1.VolumeSource) (*KubeVolume, error) {
} else if volumeSource.PersistentVolumeClaim != nil {
return VolumeFromPersistentVolumeClaim(volumeSource.PersistentVolumeClaim)
} else {
- return nil, errors.Errorf("HostPath and PersistentVolumeClaim are currently the conly supported VolumeSource")
+ return nil, errors.Errorf("HostPath and PersistentVolumeClaim are currently the only supported VolumeSource")
}
}
diff --git a/test/system/015-help.bats b/test/system/015-help.bats
index 22db8be8a..5f38c34a1 100644
--- a/test/system/015-help.bats
+++ b/test/system/015-help.bats
@@ -12,22 +12,11 @@
#
load helpers
-# run 'podman help', parse the output looking for 'Available Commands';
-# return that list.
-function podman_commands() {
- dprint "$@"
- run_podman help "$@" |\
- awk '/^Available Commands:/{ok=1;next}/^Options:/{ok=0}ok { print $1 }' |\
- grep .
- "$output"
-}
-
-
function check_help() {
local count=0
local -A found
- for cmd in $(podman_commands "$@"); do
+ for cmd in $(_podman_commands "$@"); do
# Human-readable podman command string, with multiple spaces collapsed
command_string="podman $* $cmd"
command_string=${command_string// / } # 'podman x' -> 'podman x'
diff --git a/test/system/070-build.bats b/test/system/070-build.bats
index 59da503a6..8e9a2d613 100644
--- a/test/system/070-build.bats
+++ b/test/system/070-build.bats
@@ -381,6 +381,48 @@ a${random3}z"
run_podman rmi -f build_test
}
+@test "podman build --layers test" {
+ rand_content=$(random_string 50)
+ tmpdir=$PODMAN_TMPDIR/build-test
+ run mkdir -p $tmpdir
+ containerfile=$tmpdir/Containerfile
+ cat >$containerfile <<EOF
+FROM $IMAGE
+RUN echo $rand_content
+EOF
+
+ # Build twice to make sure second time uses cache
+ run_podman build -t build_test $tmpdir
+ if [[ "$output" =~ "Using cache" ]]; then
+ is "$output" "[no instance of 'Using cache']" "no cache used"
+ fi
+
+ run_podman build -t build_test $tmpdir
+ is "$output" ".*cache" "used cache"
+
+ run_podman build -t build_test --layers=true $tmpdir
+ is "$output" ".*cache" "used cache"
+
+ run_podman build -t build_test --layers=false $tmpdir
+ if [[ "$output" =~ "Using cache" ]]; then
+ is "$output" "[no instance of 'Using cache']" "no cache used"
+ fi
+
+ BUILDAH_LAYERS=false run_podman build -t build_test $tmpdir
+ if [[ "$output" =~ "Using cache" ]]; then
+ is "$output" "[no instance of 'Using cache']" "no cache used"
+ fi
+
+ BUILDAH_LAYERS=false run_podman build -t build_test --layers=1 $tmpdir
+ is "$output" ".*cache" "used cache"
+
+ BUILDAH_LAYERS=1 run_podman build -t build_test --layers=false $tmpdir
+ if [[ "$output" =~ "Using cache" ]]; then
+ is "$output" "[no instance of 'Using cache']" "no cache used"
+ fi
+
+ run_podman rmi -a --force
+}
function teardown() {
# A timeout or other error in 'build' can leave behind stale images
diff --git a/test/system/600-completion.bats b/test/system/600-completion.bats
new file mode 100644
index 000000000..1e43cdc41
--- /dev/null
+++ b/test/system/600-completion.bats
@@ -0,0 +1,272 @@
+#!/usr/bin/env bats -*- bats -*-
+#
+# Test podman shell completion
+#
+# Shell completion is provided via the cobra library
+# It is implement by calling a hidden subcommand called "__complete"
+#
+
+load helpers
+
+function check_shell_completion() {
+ local count=0
+
+ # Newline character; used for confirming string output
+ local nl="
+"
+
+ for cmd in $(_podman_commands "$@"); do
+ # Human-readable podman command string, with multiple spaces collapsed
+ name="podman"
+ if is_remote; then
+ name="podman-remote"
+ fi
+ command_string="$name $* $cmd"
+ command_string=${command_string// / } # 'podman x' -> 'podman x'
+
+ run_podman "$@" $cmd --help
+ local full_help="$output"
+
+ # The line immediately after 'Usage:' gives us a 1-line synopsis
+ usage=$(echo "$full_help" | grep -A1 '^Usage:' | tail -1)
+ [ -n "$usage" ] || die "podman $cmd: no Usage message found"
+
+ # If usage ends in '[command]', recurse into subcommands
+ if expr "$usage" : '.*\[command\]$' >/dev/null; then
+ check_shell_completion "$@" $cmd
+ continue
+ fi
+
+ # Trim to command path so we only have the args
+ args="${usage/$command_string/}"
+ # Trim leading whitespaces
+ args="${args#"${args%%[![:space:]]*}"}"
+
+ # Extra args is used to match the correct argument number for the command
+ # This is important because some commands provide different suggestions based
+ # on the number of arguments.
+ extra_args=()
+
+ for arg in $args; do
+
+ match=false
+ i=0
+ while true; do
+
+ case $arg in
+
+ # If we have options than we need to check if we are getting flag completion
+ "[options]")
+ # skip this for remote it fails if a command only has the latest flag e.g podman top
+ if ! is_remote; then
+ run_completion "$@" $cmd "--"
+ # If this fails there is most likely a problem with the cobra library
+ is "${lines[0]}" "--.*" "Found flag in suggestions"
+ [ ${#lines[@]} -gt 2 ] || die "No flag suggestions"
+ _check_completion_end NoFileComp
+ fi
+ # continue the outer for args loop
+ continue 2
+ ;;
+
+ *CONTAINER*)
+ run_completion "$@" $cmd "${extra_args[@]}" ""
+ is "$output" ".*-$random_container_name${nl}" "Found expected container in suggestions"
+
+ match=true
+ # resume
+ ;;&
+
+ *POD*)
+ run_completion "$@" $cmd "${extra_args[@]}" ""
+ is "$output" ".*-$random_pod_name${nl}" "Found expected pod in suggestions"
+ _check_completion_end NoFileComp
+
+ match=true
+ # resume
+ ;;&
+
+ *IMAGE*)
+ run_completion "$@" $cmd "${extra_args[@]}" ""
+ is "$output" ".*localhost/$random_image_name:$random_image_tag${nl}" "Found expected image in suggestions"
+
+ # check that we complete the image with and without tag after at least one char is typed
+ run_completion "$@" $cmd "${extra_args[@]}" "${random_image_name:0:1}"
+ is "$output" ".*$random_image_name:$random_image_tag${nl}" "Found expected image with tag in suggestions"
+ is "$output" ".*$random_image_name${nl}" "Found expected image without tag in suggestions"
+
+ # check that we complete the image id after at least two chars are typed
+ run_completion "$@" $cmd "${extra_args[@]}" "${random_image_id:0:2}"
+ is "$output" ".*$random_image_id${nl}" "Found expected image id in suggestions"
+
+ match=true
+ # resume
+ ;;&
+
+ *NETWORK*)
+ run_completion "$@" $cmd "${extra_args[@]}" ""
+ is "$output" ".*$random_network_name${nl}" "Found network in suggestions"
+ _check_completion_end NoFileComp
+
+ match=true
+ # resume
+ ;;&
+
+ *VOLUME*)
+ run_completion "$@" $cmd "${extra_args[@]}" ""
+ is "$output" ".*$random_volume_name${nl}" "Found volume in suggestions"
+ _check_completion_end NoFileComp
+
+ match=true
+ # resume
+ ;;&
+
+ *REGISTRY*)
+ run_completion "$@" $cmd "${extra_args[@]}" ""
+ ### FIXME how can we get the configured registries?
+ _check_completion_end NoFileComp
+ ### FIXME this fails if no registries are configured
+ [[ ${#lines[@]} -gt 2 ]] || die "No registries found in suggestions"
+
+ match=true
+ # resume
+ ;;&
+
+ *PATH* | *CONTEXT* | *KUBEFILE* | *COMMAND* | *ARG...* | *URI*)
+ # default shell completion should be done for everthing which accepts a path
+ run_completion "$@" $cmd "${extra_args[@]}" ""
+
+ # cp is a special case it returns ShellCompDirectiveNoSpace
+ if [[ "$cmd" == "cp" ]]; then
+ _check_completion_end NoSpace
+ else
+ _check_completion_end Default
+ [[ ${#lines[@]} -eq 2 ]] || die "Suggestions are in the output"
+ fi
+ ;;
+
+ *)
+ if [[ "$match" == "false" ]]; then
+ dprint "UNKNOWN arg: $arg for $command_string ${extra_args[*]}"
+ fi
+ ;;
+
+ esac
+
+ # Increment the argument array
+ extra_args+=("arg")
+
+ i=$(($i + 1))
+ # If the argument ends with ...] than we accept 0...n args
+ # Loop three times to make sure we are not only completing the first arg
+ if [[ ! ${arg} =~ "..." ]] || [[ i -gt 3 ]]; then
+ break
+ fi
+
+ done
+
+ done
+
+ # If the command takes no more parameters make sure we are getting no completion
+ if [[ ! ${args##* } =~ "..." ]]; then
+ run_completion "$@" $cmd "${extra_args[@]}" ""
+ _check_completion_end NoFileComp
+ if [ ${#lines[@]} -gt 2 ]; then
+ # checking for line count is not enough since we may inlcude additional debug output
+ # lines starting with [Debug] are allowed
+ i=0
+ length=$(( ${#lines[@]} - 2 ))
+ while [[ i -lt length ]]; do
+ [[ "${lines[$i]:0:7}" == "[Debug]" ]] || die "Suggestions are in the output"
+ i=$(( i + 1 ))
+ done
+ fi
+ fi
+
+ done
+
+}
+
+# run the completion cmd
+function run_completion() {
+ PODMAN="$PODMAN_COMPLETION" run_podman "$@"
+}
+
+# check for the given ShellCompDirective (always last line)
+function _check_completion_end() {
+ is "${lines[-1]}" "Completion ended with directive: ShellCompDirective$1" "Completion has wrong ShellCompDirective set"
+}
+
+
+@test "podman shell completion test" {
+
+ random_container_name=$(random_string 30)
+ random_pod_name=$(random_string 30)
+ random_image_name=$(random_string 30)
+ random_image_name=${random_image_name,,} # name must be lowercase
+ random_image_tag=$(random_string 5)
+ random_network_name=$(random_string 30)
+ random_volume_name=$(random_string 30)
+
+ # create a container for each state since some commands are only suggesting running container for example
+ run_podman create --name created-$random_container_name $IMAGE
+ run_podman run --name running-$random_container_name -d $IMAGE top
+ run_podman run --name pause-$random_container_name -d $IMAGE top
+ run_podman pause pause-$random_container_name
+ run_podman run --name exited-$random_container_name -d $IMAGE echo exited
+
+ # create pods for each state
+ run_podman pod create --name created-$random_pod_name
+ run_podman pod create --name running-$random_pod_name
+ run_podman run -d --name running-$random_pod_name-con --pod running-$random_pod_name $IMAGE top
+ run_podman pod create --name degraded-$random_pod_name
+ run_podman run -d --name degraded-$random_pod_name-con --pod degraded-$random_pod_name $IMAGE echo degraded
+ run_podman pod create --name exited-$random_pod_name
+ run_podman run -d --name exited-$random_pod_name-con --pod exited-$random_pod_name $IMAGE echo exited
+ run_podman pod stop exited-$random_pod_name
+
+ # create image name (just tag with new names no need to pull)
+ run_podman image tag $IMAGE $random_image_name:$random_image_tag
+ run_podman image list --format '{{.ID}}' --filter reference=$random_image_name
+ random_image_id="${lines[0]}"
+
+ # create network
+ run_podman network create $random_network_name
+
+ # create volume
+ run_podman volume create $random_volume_name
+
+
+ # $PODMAN may be a space-separated string, e.g. if we include a --url.
+ local -a podman_as_array=($PODMAN)
+ # __completeNoDesc must be the first arg if we running the completion cmd
+ PODMAN_COMPLETION="${podman_as_array[0]} __completeNoDesc ${podman_as_array[@]:1}"
+
+ # Called with no args -- start with 'podman --help'. check_shell_completion() will
+ # recurse for any subcommands.
+ check_shell_completion
+
+ # cleanup
+ run_podman volume rm $random_volume_name
+
+ run_podman network rm $random_network_name
+
+ run_podman image untag $IMAGE $random_image_name:$random_image_tag
+
+ for state in created running degraded exited; do
+ run_podman pod rm --force $state-$random_pod_name
+ done
+
+ for state in created running pause exited; do
+ run_podman rm --force $state-$random_container_name
+ done
+
+ # Clean up the pod pause image
+ run_podman image list --format '{{.ID}} {{.Repository}}'
+ while read id name; do
+ if [[ "$name" =~ /pause ]]; then
+ run_podman rmi $id
+ fi
+ done <<<"$output"
+
+}
diff --git a/test/system/helpers.bash b/test/system/helpers.bash
index 2cced10c2..6a7c6cc42 100644
--- a/test/system/helpers.bash
+++ b/test/system/helpers.bash
@@ -521,5 +521,15 @@ function remove_same_dev_warning() {
output=$(printf '%s\n' "${lines[@]}")
}
+# run 'podman help', parse the output looking for 'Available Commands';
+# return that list.
+function _podman_commands() {
+ dprint "$@"
+ run_podman help "$@" |
+ awk '/^Available Commands:/{ok=1;next}/^Options:/{ok=0}ok { print $1 }' |
+ grep .
+ "$output"
+}
+
# END miscellaneous tools
###############################################################################