45231: _rsync: When completing remote modules, ignore more of the motd.

We cannot use the --no-motd option because it inhibits the modules
listing.

We cannot look for a blank line because there will not be a blank line
if the "motd file" does not end with a newline.

Looking for tabs is an improvement.  Any tabs in the motd will still
cause extraneous matches, but there's nothing we can do about that.

While here, show the modules in the order listed.
This commit is contained in:
Daniel Shahaf 2020-01-04 14:39:44 +00:00
parent 3ff0b189a0
commit 7542732df6
2 changed files with 7 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2020-01-06 Daniel Shahaf <danielsh@apache.org>
* 45231: Completion/Unix/Command/_rsync: When completing remote
modules, ignore more of the motd.
2020-01-05 dana <dana@dana.is>
* unposted: Completion/Unix/Command/_tac: Eliminate superfluous

View file

@ -51,10 +51,11 @@ elif compset -P 1 '*::' || compset -P 1 'rsync://*/'; then
fi
remfiles=(${${(f)"$(_call_program files rsync $pat 2>/dev/null)"}:#([ ]|MOTD:)*})
remfiles=( ${(M)remfiles:#*$'\t'*} )
remmodules=(${remfiles/[ ]##/:})
_describe "remote modules" remmodules -S/
_describe -V "remote modules" remmodules -S/
elif compset -P 'rsync://'; then
_rsync_user_or_host / "$@"