# The following was supposedly scribed by
# Caleb Epstein
# on Tuesday 29 June 2004 11:27 pm:

>>   -f, --force, --noforce     force overwrite of existing files  (default:
>>  no)
>
>        I assume that for this module to know that "--noforce" is
>        viable, you mistakenly omitted the "!" at the end of
>        'f|force!'?

Yes.  I was copying into the email while simultaneously revising my code:)

>        Documentation that arguments are array-refs ("@") are
>        which can be specified multiple times would be a neat feature,
>        too.

I'm not sure what you mean by this.  That the help message should mark options 
as arrays and hashes?  I'm not sure that I want that to be so automatic  
(maybe just a list of symbols at the end of the line (e.g. "s@" for string 
array?)) 

Well, the help_string() function is operable now and into the subversion repo 
at http://ericwilhelm.homeip.net/svn/Getopt-Helpful/trunk/code/Getopt/

I tried to use the Getopt::Long::ParseOptionSpec() function, but ended up with 
some naive regex operations instead.  If you have svn, you can take a look a 
couple of versions back.  It wasn't very pretty.

The only magic that currently happens is related to the third argument in the 
rows given to new().  When you make a help_string(), you get your option name 
in <>'s unless the option had no type (boolean) or you had passed an explicit 
'<arg is a file>' kind of string.

my $hopt = Getopt::Helpful->new(
        ['n|name=s', \$name, '',  # <-- here arg string is undef
                "name for new part"],
        ['p|parts=s', \$parts, '<parts dir>', # <-- this one is explicit
                "directory containing parts (default $parts)"],
        );
print $hopt->help_string;

This prints:

  options:
    -n, --name <name>
        name for new part

    -p, --parts <parts dir>
        directory containing parts (default parts/)


--Eric
-- 
"These crispix get soggy so quickly."
                                        -- Tina Connolly

Reply via email to