diff options
author | Paul Holzinger <paul.holzinger@web.de> | 2021-02-08 18:31:30 +0100 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2021-02-11 13:20:03 -0500 |
commit | f12e26ced9be419dba621b3309cbf8dac661ed2c (patch) | |
tree | ad22b6e7d191c25e7be2459baba61de711812621 /cmd | |
parent | 2b89fe7d5dcf4e2e33127eaefdb02419c42592a6 (diff) | |
download | podman-f12e26ced9be419dba621b3309cbf8dac661ed2c.tar.gz podman-f12e26ced9be419dba621b3309cbf8dac661ed2c.tar.bz2 podman-f12e26ced9be419dba621b3309cbf8dac661ed2c.zip |
Allow path completion for podman create/run --rootfs
If the --rootfs flag is set podman create/run expect a host
path as first argument. The shell completion should provide
path completion in that case.
[NO TESTS NEEDED]
This can manually be verified with `podman run --rootfs [TAB]`.
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/common/completion.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/cmd/podman/common/completion.go b/cmd/podman/common/completion.go index 09dd74e20..92163efde 100644 --- a/cmd/podman/common/completion.go +++ b/cmd/podman/common/completion.go @@ -426,6 +426,12 @@ func AutocompleteCreateRun(cmd *cobra.Command, args []string, toComplete string) return nil, cobra.ShellCompDirectiveNoFileComp } if len(args) < 1 { + // check if the rootfs flag is set + // if it is set to true provide directory completion + rootfs, err := cmd.Flags().GetBool("rootfs") + if err == nil && rootfs { + return nil, cobra.ShellCompDirectiveFilterDirs + } return getImages(cmd, toComplete) } // TODO: add path completion for files in the image |