Re: Stanford IDG internal Perl style
On 2013-04-06 05:26, Russ Allbery wrote:
>> $opt->mode eq 't' instead of $opt->mode eq 'tags'
>> $opt->h instead of $opt->help
> Yeah, I was looking at that when I reviewed the document, and I think
> that's backwards. It's left over from an old style we had for
> Getopt::Long where it didn't matter. I'm going to change that.
>
Noted. :)
Do you have some examples of complex usage of Getopt::Long::Descriptive
by the way? I had a stab at rewriting lintian's option parsing and for
sometimes I cannot find the way to do it with G::L::Descriptive.
Particularly, --display-info + --pedantic is translated to
--display-level. While it is trivial to collect all the information and
merge it manually it loses the order. (i.e. --pedantic --display-level
X is sometimes different from --display-level X --pedantic).
The possibility to having a sub interpreting the opt+value would do just
fine but I have not figured how to do it (if at all possible).
>> > Regarding the use of:
>> > Usage: lintian-info ...
>> > Usage: lintian-info --annotate
>> > Usage: lintian-info --tags ...
>> > For some reason, it only treats newlines as newlines if they are not
>> > followed by \t or space. Possible reasons could be that the string is
>> > "s/\s\s++/ /"'ed, but I haven't checked the code.
> Oh, that's kind of annoying. Although we conventionally ommitted the
> Usage: for subsequent lines anyway and just said:
>
> Usage: lintian-info ...
> lintian-info --annotate
> lintian-info --tags ...
>
That is the way I wanted to write it, but even "\n\t" is "two or more
spaces" and gets translated to " " resulting in:
Usage: lintian-info ... lintian-info --annotate [... and so on]
i.e. one long unreadable line.
~Niels
Reply to: