diff options
author | 2024-10-03 21:02:04 +0100 | |
---|---|---|
committer | 2024-10-03 21:02:04 +0100 | |
commit | 8952cac62f1cafce0c4064ab35d841244365a714 (patch) | |
tree | a52f6ee66a2a3499c5da65ffcd681c370262a8e2 | |
parent | Update version specifier tags in eval-deps (diff) |
Update nsjail_args and py_args to store_const instead of nargs='?'
When using nargs='?' the nsjail_args argument was sometimes consuming 1 of the arguments passed to the module.
By setting these two arguments to store_const actions instead, this is no longer the case, as they will always use the constant specified now.
This is more appropriate for their actual use case of being purely for documentation.
Co-authored-by: GDWR <[email protected]>
-rw-r--r-- | snekbox/__main__.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/snekbox/__main__.py b/snekbox/__main__.py index 239f5d5..1e5bcec 100644 --- a/snekbox/__main__.py +++ b/snekbox/__main__.py @@ -13,10 +13,16 @@ def parse_args() -> argparse.Namespace: ) parser.add_argument("code", help="the Python code to evaluate") parser.add_argument( - "nsjail_args", nargs="?", default=[], help="override configured NsJail options" + "nsjail_args", + action="store_const", + const=[], + help="override configured NsJail options (default: [])", ) parser.add_argument( - "py_args", nargs="?", default=["-c"], help="arguments to pass to the Python process" + "py_args", + action="store_const", + const=["-c"], + help="arguments to pass to the Python process (default: ['-c'])", ) # nsjail_args and py_args are just dummies for documentation purposes. |