mpeterv / argparse

Feature-rich command line parser for Lua
MIT License
251 stars 43 forks source link

Allow option to handle exit programmatically #8

Closed bitinn closed 8 years ago

bitinn commented 8 years ago

related to #7, if you are using a game engine for lua instead of pure lua, it's likely the proper shutdown isn't os.exit, in those cases, it might be better to let end-user handle the shutdown.

Returning nil instead of exiting on parser:parse() would be a solution.

ref: https://love2d.org/wiki/love.event.quit

mpeterv commented 8 years ago

Right, having a way to set a custom exit function would make sense. If you don't want to exit at all you can use parser:pparse(), although --help will still quit.

bitinn commented 8 years ago

yep, my bad :)