Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow path completion for podman create/run --rootfs #9269

Merged

Conversation

Luap99
Copy link
Member

@Luap99 Luap99 commented Feb 8, 2021

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].

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Luap99

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 8, 2021
@mheon
Copy link
Member

mheon commented Feb 8, 2021

LGTM

// if it is set to true we have to provide path completion
rootfs, err := cmd.Flags().GetBool("rootfs")
if err == nil && rootfs {
return nil, cobra.ShellCompDirectiveDefault
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious: why not ShellCompDirectiveFilterDirs ? Can rootfs ever be something other than a directory path? (e.g. tarball, image)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it has to be a directory.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I completely forgot that this option exists.

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]>
@Luap99 Luap99 force-pushed the rootfs-shell-completion branch from 33ec32f to 1caace8 Compare February 8, 2021 19:12
@rhatdan
Copy link
Member

rhatdan commented Feb 8, 2021

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 8, 2021
@edsantiago
Copy link
Member

Aw, phooey. I was just about to slash-lgtm when I remembered: this will have no effect unless we update the completion files themselves. @Luap99 since you're the only one who knows how to bring in the proper magic version of cobra, could you

/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 8, 2021
@edsantiago
Copy link
Member

Sorry, had to hold really fast

...could you do so and resubmit?

@edsantiago
Copy link
Member

PS make completions should now work

@Luap99
Copy link
Member Author

Luap99 commented Feb 9, 2021

/hold cancel

@edsantiago There is no need to update the completion files. bin/podman run --rootfs [TAB] should work as expected now. Almost all completion logic exists in go so once we update the binary it should work.

The completions files only needs to be updated for bug fixes in the scripts etc... For example the fish completion doesn't support ShellCompDirectiveFilterDirs and will use the default completion instead. This is fine but if ShellCompDirectiveFilterDirs is implemented for fish we would need to update the script.

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 9, 2021
@openshift-merge-robot openshift-merge-robot merged commit 9da4169 into containers:master Feb 9, 2021
@Luap99 Luap99 deleted the rootfs-shell-completion branch February 9, 2021 09:53
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants