aboutsummaryrefslogtreecommitdiffstats
path: root/util/argparse.lua
Commit message (Collapse)AuthorAgeFilesLines
* util.argparse: Fix bug (regression?) in argument parsing with --foo=barMatthew Wild8 days1-2/+6
| | | | | | | | | | | | | | | | After recent changes, '--foo bar' was working, but '--foo=bar' was not. The test had a typo (?) (bar != baz) and because util.argparse is not strict by default, the typo was not caught. The typo caused the code to take a different path, and bypassed the buggy handling of --foo=bar options. I've preserved the existing test (typo and all!) because it's still an interesting test, and ensures no unintended behaviour changes compared to the old code. However I've added a new variant of the test, with strict mode enabled and the typo fixed. This test failed due to the bug, and this commit introduces a fix.
* util.argparse: Add strict mode + testsMatthew Wild2025-02-171-3/+10
|
* util.argparse: Optionally continue processing past positional parametersMatthew Wild2025-02-171-30/+40
|
* util.argparse: Add support for repeatable parametersKim Alvefur2022-01-051-2/+11
| | | | These are gathered into arrays
* util.argparse: Translate '-' to '_' in long option names for convenienceMatthew Wild2023-04-071-0/+1
| | | | A review of existing code suggests nothing will break. So, here we go...
* util.argparse: Revise 553c6204fe5b with a different approachMatthew Wild2022-04-251-2/+5
| | | | | | The second return value is (not insensibly) assumed to be an error. Instead of returning a value there in the success case, copy the positional arguments into the existing opts table.
* util.argparse: Return final 'arg' table with positional arguments for ↵Matthew Wild2022-04-251-2/+2
| | | | | | | | convenience This is the same as the input table (which is mutated during processing), but if that table was created on the fly, such as by packing `...` it's convenient if it also gets returned from the parse function.
* Merge 0.11->trunkKim Alvefur2021-10-121-1/+1
|
* util.argparse: Move exiting and error to util.startupKim Alvefur2020-06-171-5/+2
| | | | | | | | It's not so nice to have a library that exits the entire application from under you, so this and the error reporting belongs in util.startup. The argparse code was originally in util.startup but moved out in 1196f1e8d178 but the error handling should have stayed.
* util.startup: Break out command line argument parsing into util.argparseKim Alvefur2020-02-191-0/+58
This will allow using it from other places such as prosodyctl sub-commands and plugins