lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Automatically generate a custom command-line option parser from just the long-form help text for your program.

I am happy to announce release 1.5 of optparse.

Optparse's home page is at https://github.com/gvvaughan/optparse, with documentation at https://gvvaughan.github.io/optparse.

This was the option parser I originally wrote for Specl, and later donated to lua-stdlib. Even though I’ve not yet completed the slimming down of lua-stdlib in preparation for the next release, you can continue to use optparse without installing stdlib.

This release fixes **another** long standing bug.

Install it with LuaRocks, using:

   luarocks install optparse 1.5


## Noteworthy changes in release 1.5 (2022-07-30) [stable]

### Bug fixes

  - The parser no longer shadows the internal `optparse.version`
    `on_handler` by also saving the last word of the parsed
    `versiontext` into `optparse.version`.

    But, we don't want to break existing clients that use the content
    of the saved `optparse.version` string either.  Since the
    `on_handler` was never available to callers before due to being
    shadowed, rename it to `optparse.showversion`.

### Incompatible changes

  - For consistency with the renaming of `optparse.showversion`,
    similarly rename `optparse.help` to `optparse.showhelp`.  For
    backwards compatibility, `optparse.help` continues to be available
    too, but is now undocumented.  Consider using the `showhelp` in
    your projects, especially if you also start using `showversion`.