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

Re: Move command line options to start of line



Bart Schaefer wrote:
> On Oct 6,  4:07pm, Peter Stephenson wrote:
> }
> } # This moves an option, possibly with arguments, from before the
> } # cursor to immediately after the command word.
> 
> Nice, but not precisely what David Korn had in mind.  Given
> 
> zsh% ls -s file1 file2 -l
> 
> the result of the command should be
> 
> zsh% ls -s -l file1 file2
> 
> and not
> 
> zsh% ls -l -s file1 file2

Why?  The option order doesn't usually matter for separate standalone
options, and if the order does matter, the function isn't going to be
able to guess which way round things have to be anyway.  I quite
deliberately did it the way I did because of options taking arguments.
Consider (example contrived on the spur of the moment, but not wholly
unrealistic):

  su -c 'rm -f .zshrc' username -l

Your way, this becomes

  su -c -l 'rm -f .zshrc' username

which is wrong.

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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