Skip to content

Commit

Permalink
[internal] Add a way to append values to optional arguments in `parse…
Browse files Browse the repository at this point in the history
…_arguments` decorator
  • Loading branch information
ValekoZ committed Jun 24, 2024
1 parent c450a2d commit fd5b5e1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,10 @@ def wrapper(*args: Any, **kwargs: Any) -> Callable:
elif argtype is bool:
parser.add_argument(*argname, action="store_false" if argvalue else "store_true")
continue
elif argtype in (list, tuple):
parser.add_argument(*argname, type=type(argvalue[0]),
default=[], action='append')
continue
parser.add_argument(*argname, type=argtype, default=argvalue)

parsed_args = parser.parse_args(*(args[1:]))
Expand Down

0 comments on commit fd5b5e1

Please sign in to comment.