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

lvm: improve completions for lvremove #1335

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

siteshwar
Copy link

It should have a completion for /dev/mapper path.

It should have a completion for `/dev/mapper` path.

Signed-off-by: Siteshwar Vashisht <[email protected]>
@siteshwar
Copy link
Author

This is a fix for https://bugzilla.redhat.com/show_bug.cgi?id=2317249.

You can test it by running lvremove /d<TAB>.

@@ -33,6 +33,8 @@ _comp_cmd_lvm__logicalvolumes()
for i in "${!COMPREPLY[@]}"; do
[[ ${COMPREPLY[i]} == */control ]] && unset -v 'COMPREPLY[i]'
done
elif [[ $cur == /d* ]]; then
COMPREPLY+="/dev/mapper"
Copy link
Collaborator

@akinomyoga akinomyoga Feb 20, 2025

Choose a reason for hiding this comment

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

This will append the string /dev/mapper to the first completion, which would result in a result e.g. /dev/vg0/gfslv/dev/mapper when a completion /dev/vg0/gfslv is already generated.

Also, shouldn't we complete /dev/mapper/ instead of /dev/mapper?

In addition, we already have the utility of "check prefix & add to COMPREPLY". We shouldn't do that manually. For the present change, you can simply _comp_compgen -- -W '/dev/mapper'. However, we already call _comp_compgen_split on line 28, so we can simply add /dev/mapper/ at the end of line 29.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants