mirror of
https://github.com/containers/podman.git
synced 2025-06-24 19:42:56 +08:00
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>
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user