Skip to content

Commit 1caace8

Browse files
author
Paul Holzinger
committed
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 <[email protected]>
1 parent 2bf1321 commit 1caace8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cmd/podman/common/completion.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,12 @@ func AutocompleteCreateRun(cmd *cobra.Command, args []string, toComplete string)
426426
return nil, cobra.ShellCompDirectiveNoFileComp
427427
}
428428
if len(args) < 1 {
429+
// check if the rootfs flag is set
430+
// if it is set to true provide directory completion
431+
rootfs, err := cmd.Flags().GetBool("rootfs")
432+
if err == nil && rootfs {
433+
return nil, cobra.ShellCompDirectiveFilterDirs
434+
}
429435
return getImages(cmd, toComplete)
430436
}
431437
// TODO: add path completion for files in the image

0 commit comments

Comments
 (0)