Autocomplete for file names doesn't work (partially) [bash]
See original GitHub issueHello!
When I use autocompletion script from here https://github.com/iterative/dvc.org/blob/master/static/docs/user-guide/autocomplete.md
it doesn’t complete file and directory names from current directory for the command dvc repro ...
.
But if I add some flag, for example dvc repro --force ...
then it works fine.
What should be changed in bash autocomplete script to allow autocompletion for dvc repro ...
without any flags?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:19 (9 by maintainers)
Top Results From Across the Web
Bash Auto-completion with Tab button doesn't ... - Super User
In my Kubuntu there is no /usr/share/bash-completion/completions/vim file, but the file /usr/share/bash-completion/bash_completion.
Read more >Why bash disables autocompletion for some commands and ...
I have files starting with "ba" in my home/working dir. When I type "ba[tab]" at the prompt, I do not get these names,...
Read more >bash filename autocomplete - does it have to use so much ...
I have a vague memory of this working in the past, but can't find any info now. Using TAB in bash to show...
Read more >How to autocomplete long file names in terminal - Server Fault
If I have in current directory a file with a long name starting with "build" I can write in console "build", press Tab...
Read more >How do I make Vim do normal (Bash-like) tab completion for ...
If you don't want to set the wildmenu, you can always press Ctrl + L when you want to open a file. Ctrl...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Not having the completions is definitely annoying, I switched to zsh just to have them 😃
Would it be possible to make the completions work for 3-token commands (not sure if this is the right terminology) - for example
dvc pipeline show <tab to choose a file>
?The current behavior for
dvc pipeline show <tab>
is to list the available options:And the output for
dvc pipeline show incomplete_filename<tab>
ismeaning one has to type the complete filename by hand.
Would certainly be a nice to have!
ohh my bad, @belskikh ! 🙈
I don’t have a good understanding of Bash’s completion engine, but you’ll need to add something like
compgen -f -X '!*.dvc'
over here https://github.com/iterative/dvc/blob/dd8598e53ea03aaa7554c6ebf8fa7fe37baffc31/scripts/completion/dvc.bash#L57-L63Be aware that some commands accepts something more than just stage files (the ones ending in
.dvc
).The script itself have some references that you can look up to understand how the file was created, I’ll leave you with one more: https://www.linuxjournal.com/content/more-using-bash-complete-command
By the way, installing Zsh is not that hard:
And you are all set!
If you want colors and stuff like that, I can recommend you the pure prompt
I’m currently using spaceship-prompt but requires a little bit more of configuration.
There’s also geometry prompt
Those are my favorites 😅 .
Anyways, if you manage to make completion work with bash it would be awesome! good luck 🦆