Skip to content

Commit 9da4169

Browse files
Merge pull request #9269 from Luap99/rootfs-shell-completion
Allow path completion for podman create/run --rootfs
2 parents 58810fb + 1caace8 commit 9da4169

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)