Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: rsync hosts completion not working after aliased



On Apr 6,  2:58pm, sam.reckoner@xxxxxxxxx wrote:
} 
} alias rsync='/bin/rsync -uavz --progress -e ssh --chmod=Dg-rx,Do-rx'
} 
} and then it doesn't complete anything, even files. I do _complete_help on  
} this and it shows nothing.

I'm not sure why _complete_help shows nothing, but if you try instead to
complete the raw command you can get more details.

There are several problems with the _rsync completer (or that are being
demonstrated by the _rsync completer, anyway).  For example, if I first
do:

torch% rsync -<TAB>
Completing option
--8-bit-output         -8              -- leave high-bit chars unescaped in ou
--acls                 -A              -- preserve access-control lists
--address                              -- bind to the specified address
--append                               -- append data onto shorter files
(etc., scrolls off the page)

OK, I'm in menu selection, as I should be.  Mouse around a bit and choose
one of the options and hit enter:

torch% rsync --append 
zsh: do you wish to see all 408 possibilities (137 lines)? 

It's acting as though I hit TAB again.  How did we go straight into list
mode from menu-select?

Anyway, after being sidetracked by that for a bit, we come to the crux
of your problem, which is this:

torch% rsync --append --chmod=<TAB>
torch% rsync --append --chmod 
Completing corrections
--chmod                -- change destination permissions
Completing original
--chmod=

So the completion function hasn't been told that you can append the set
of modes [*] to the --chmod option with an equal sign, and it gets very
confused trying to find suggested completions for an option whose name
is "chmod=Dg-rx,Do-rx".

If you instead make it "--chmod Dg-rx,Do-rx" then completion proceeds
normally.

[*] The descriptive text for the argument following --chmod says that 
it expects "mods".  No; it expects "modes".  Unix programmers 25 years
ago were vowel-stingy in the name of having less to type.



Messages sorted by: Reverse Date, Date, Thread, Author