Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Move command line options to start of line
- X-seq: zsh-users 10808
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx (Zsh users list), pws@xxxxxxxxxxxxxxxxx
- Subject: Re: Move command line options to start of line
- Date: Sat, 07 Oct 2006 13:02:11 +0100
- In-reply-to: Message from Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> of "Fri, 06 Oct 2006 19:55:00 PDT." <061006195500.ZM29412@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
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