Timeline for How do I get bash completion for command aliases?
Current License: CC BY-SA 4.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 24 at 0:35 | comment | added | Crimson |
@aless80 I was able to get completion for git checkout with _completion_loader "git"; __git_complete ALIAS _git_checkout
|
|
Jul 21 at 21:57 | history | edited | Pablo A | CC BY-SA 4.0 |
Improved formatting. Minor fixes.
|
Feb 3, 2024 at 18:47 | comment | added | jyn |
also, . /usr/share/bash-completions doesn't work if the command is installed locally (e.g. ~/.local/bin or /usr/local/share). instead try __load_completion rsync (stackoverflow.com/a/61544119)
|
|
Feb 3, 2024 at 18:29 | comment | added | jyn |
this worked and it was quite simple. to avoid having to duplicate the complete options, you can print the completion dynamically like so: $(complete -p rsync | rev | cut -d' ' -f 2- | rev) mycommand
|
|
S Dec 14, 2023 at 18:44 | history | suggested | Mo_ | CC BY-SA 4.0 |
As written in comment, answer only works when rsync completion was invoked before.
|
Oct 19, 2023 at 12:33 | review | Suggested edits | |||
S Dec 14, 2023 at 18:44 | |||||
Jan 19, 2023 at 10:10 | comment | added | aless80 |
what about a command with sub-command like git checkout ?
|
|
Jun 30, 2020 at 8:10 | comment | added | Myridium |
Turns out that the way to do this is call _completion_loader rsync first, to make sure the completion function is loaded. It is sometimes (always?) loaded only when you try to autocomplete with the function for the first time. This answer also has another problem: it cannot autocomplete with the context of arguments provided. E.g. it cannot make an alias for pass -c autocomplete like pass -c , only like pass . These are different.
|
|
May 17, 2020 at 22:50 | comment | added | Myridium |
It seems that bash says bash: complete: XYZ: no completion specification until you actually try to complete with XYZ the first time. I think editing the user .bash_completion file is the way to go, though I'm still not sure how...
|
|
Mar 3, 2020 at 10:10 | review | Late answers | |||
Mar 3, 2020 at 10:23 | |||||
Mar 3, 2020 at 9:55 | review | First posts | |||
Mar 3, 2020 at 9:57 | |||||
Mar 3, 2020 at 9:52 | history | answered | M.Ermatinger | CC BY-SA 4.0 |