-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
clap_complete bash: filenames with spaces are not completed properly #5313
Comments
I wonder if #5240 will fix it. |
Maybe we should drop Could you try the following patch to the generated completion script, and see if it works as expected? @@ -323,10 +323,12 @@
return 0
;;
--input)
- COMPREPLY=($(compgen -f "${cur}"))
+ COMPREPLY=($(compgen "${cur}"))
+ compopt -o filenames
return 0
;;
-i)
- COMPREPLY=($(compgen -f "${cur}"))
+ COMPREPLY=($(compgen "${cur}"))
+ compopt -o filenames
return 0
;;
--vfilter) If you just try #5240, please apply the following: @@ -323,10 +323,12 @@
;;
--input)
COMPREPLY=($(compgen -f "${cur}"))
+ compopt -o filenames
return 0
;;
-i)
COMPREPLY=($(compgen -f "${cur}"))
+ compopt -o filenames
return 0
;;
--vfilter)
Edit: Fixed context line, and append the example of #5240. |
@sudotac that change doesn't seem to make any difference |
Sorry, I misunderstood the usage. Actually |
FWIW if you can install bash-completion package (mostly Debian-based systems), it is possible to use @@ -322,11 +322,11 @@
return 0
;;
--input)
- COMPREPLY=($(compgen -f "${cur}"))
+ _filedir
return 0
;;
-i)
- COMPREPLY=($(compgen -f "${cur}"))
+ _filedir
return 0
;;
--vfilter) |
Please complete the following tasks
Rust Version
1.75.0
Clap Version
clap_complete: 4.4.7
Minimal reproducible code
Use clap_complete bash completions for an arg that could receive a filename.
Steps to reproduce the bug with the above code
Create directory with files, one of which has spaces in the name.
Try to complete
fo
the unique start of one filename.Actual Behaviour
Cannot complete.
Expected Behaviour
Should be able to complete handling the spaces in the file. E.g. as
ls
completions do:ls fo<TAB>
->ls foo\ bar.txt
.So I would expect:
$ ab-av1 encode -i fo<TAB>
->$ ab-av1 encode -i foo\ bar.txt
Additional Context
Downstream: alexheretic/ab-av1#180
Generated bash completion for ab-av1
Debug Output
No response
The text was updated successfully, but these errors were encountered: