[Nickle] parse-args changes, command-line revision
nickle at po8.org
nickle at po8.org
Mon Aug 1 02:32:51 PDT 2005
I've completely revised the Nickle command-line argument
parsing code. It now uses the Nickle parse-args stuff
instead of ad hoc for argument parsing. In the process,
I've changed the Nickle command line in some subtle ways:
* The -e flag is now limited to evaluating a single
argument.
* You can now have an arbitrary sequence of -e, -f, and -l
flags that will be executed in the order given.
* The -l flag and -f flag can now be used when starting
an interactive session.
* You can now get a non-empty argv in interactive mode. Use
the argument-parse-stop argument "--" and give any
arguments you want after that.
* You can now get sensible command-line help with --help
or --usage.
* Arguments are now checked much more carefully.
In the process, I made some substantial incompatible changes
to parse-args.5c.
* Positional (non-flagged) arguments are now handled with
a separate array rather than the previous kludge in
with the flags.
* Positional arguments may now be optional.
* If the program name is preset in the argd structure,
argv[0] is presumed to be the first argument, not
the program name. (Needed for Nickle startup).
* There is now an option for getting the index of
the first argument unconsumed by parseargs().
* There is now an argument type of arg_lambda, which
allows supplied code to be executed as arguments
are parsed.
If you were using ParseArgs::parseargs(), you may have to
rewrite your argument descriptions a bit.
Comments and bug reports welcome.
Bart
More information about the Nickle
mailing list