Skip to content
Discussion options

You must be logged in to vote

_comp_cmd_rsync gets the option list by running the command it was called for: "$1" --help in completions-core/rsync.bash. With complete -F _comp_cmd_rsync rs, $1 is rs, and an alias isn't expanded there, so the help call returns nothing and you get no options. The fallback _comp_compgen_usage has the same problem, since it runs comp_args[0], which is also rs. File completion still works because that path doesn't run the command.

Wrap it and pass rsync as the command name:

_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 rs

Put this after bash-completion is loaded. _comp_load (2.12+) loa…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@arkarkark
Comment options

Answer selected by arkarkark
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants