Conversation
| complete -c rsync -l numeric-ids -d "Don’t map uid/gid values by user/group name" | ||
| complete -c rsync -l usermap -xa '(__fish_complete_users)' -d "Custom username mapping" | ||
| complete -c rsync -l groupmap -xa '(__fish_complete_groups)' -d "Custom username mapping" | ||
| complete -c rsync -l chown -xa '(__fish_complete_users;__fish_complete_groups)' -d "Combined username/groupname mapping" |
There was a problem hiding this comment.
A space after the ; would be nice.
(also this does user:group, so maybe (__fish_complete_users):(__fish_complete_groups) might be helpful, or more complicated logic to only complete the group after the user - see __fish_complete_user_at_hosts for something similar)
There was a problem hiding this comment.
(__fish_complete_users):(__fish_complete_groups) unfortunately does not work in my testing, if I type : and hit TAB it removes the whole option? Is there a any simple solution for the common user:group pattern?
There was a problem hiding this comment.
Aaaah, okay, both of these provide a description (after a tab character), so only the users part is actually used (because the rest is now after a tab).
Here's what the actual chown completions do:
complete -c chown -d Username -a "(__fish_print_users):"
complete -c chown -d Username -a "(string match -r -- '.*:' (commandline -ct))(__fish_complete_groups)"You could probably make a helper function that
- if you don't have a ":" in the current token (
commandline -ct) runs__fish_complete_users - If you do, prints the current token plus everything in
__fish_complete_groups
(this would then also be useful in chown, and possibly elsewhere)
Or alternatively we can merge this as it stands and do that bit later.
There was a problem hiding this comment.
Okay, I think it is best to merge as it is and make such a helper function in a separate PR.
There was a problem hiding this comment.
Since :somegroup is valid, that might need a separate entry (untested):
(echo; __fish_print_users):(__fish_complete_groups)
|
Merged, thanks! |
Description
This adds completions for the newer (and very useful)

info+debugflags, parsed from the help output:Also many other options that were missing. Based on the current rsync 3.2.3 man page.
TODOs: