Repository navigation
reuse one command's completion for an alias #1751
|
I hope this is the right place to ask, I thought filing an issue wasn't the correct place. I have an alias for I hit tab after the I'm running |
Replies: 2 comments 1 reply
|
Wrap it and pass _comp_cmd_rs() {
declare -F _comp_cmd_rsync >/dev/null || _comp_load rsync
_comp_cmd_rsync rsync "${@:2}"
}
complete -o nospace -F _comp_cmd_rs rsPut this after bash-completion is loaded. |
|
There has also been a PR to add a utility |
_comp_cmd_rsyncgets the option list by running the command it was called for:"$1" --helpincompletions-core/rsync.bash. Withcomplete -F _comp_cmd_rsync rs,$1isrs, and an alias isn't expanded there, so the help call returns nothing and you get no options. The fallback_comp_compgen_usagehas the same problem, since it runscomp_args[0], which is alsors. File completion still works because that path doesn't run the command.Wrap it and pass
rsyncas the command name:Put this after bash-completion is loaded.
_comp_load(2.12+) loa…