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

Re: PATCH: Re: GNU-style long options for zsh



On Jul 30,  5:49pm, zefram@xxxxxxxx wrote:
} Subject: PATCH: Re: GNU-style long options for zsh
}
} 1.
} 
} Bart wrote:
} >Zsh accepts `-opts-junk' where "opts" are any valid option letters and
} >"junk" gets ignored.
} 
} This always annoyed me about zsh, and other programs that parse options
} that way.  I've fixed that such that `zsh -sh-word-split' (for example)
} is an error.

If we're going to change this from the old behavior:

I don't know for sure how this should work WRT an embedded `-', but an
embedded `b' should work like csh.  Using tcsh as the example, that means
that the NEXT word is no longer taken as an option, but that any other
letters in the CURRENT word still act like option selectors.  E.g.:

zagzig[265] tcsh -xe -foo
Unknown option: `-oo'
Usage: tcsh [ -bcdefilmnqstvVxX ] [ argument ... ].
zagzig[266] tcsh -xbe -foo
-foo: No such file or directory.
zagzig[267] tcsh -xby
Unknown option: `-y'
Usage: tcsh [ -bcdefilmnqstvVxX ] [ argument ... ].

} 2. Specifying an invalid option name on the command line causes zsh
} to exit, rather than continuing with an error message.  This makes it
} consistent with the handling of single-letter option names.

That's a pretty radical change with respect to `-o badlyspeltoption'.

} 3. "-" characters are permitted in GNU-style long option names --
} they get transformed into "_" characters -- so that the usual
} style "--sh-word-split" is permitted (Bart's version required
} "--sh_word_split").

Is there a good reason that `-' is not permitted within optlookup()?
Why not allow `setopt sh-word-split' too, and keep the special case out
of parseargs()?

} 4. Options can be turned off with "+-option-name" just like "+o
} option_name".

I actually originally had it that way, and then decided it wasn't kosher
and threw in the `action &&' test to prevent it.  Do any GNU programs
really accept `+-optionname' like that?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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