From fd5b5e1e58a1dfcccf4b8df9ab37fb4c2a460fbb Mon Sep 17 00:00:00 2001 From: ValekoZ Date: Mon, 24 Jun 2024 11:36:27 +0200 Subject: [PATCH 1/2] [internal] Add a way to append values to optional arguments in `parse_arguments` decorator --- gef.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gef.py b/gef.py index f3b9b108e..38bfa1951 100644 --- a/gef.py +++ b/gef.py @@ -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:])) From 84b2afdb9270c05b271656f6a0b772c37ec23c6c Mon Sep 17 00:00:00 2001 From: ValekoZ Date: Mon, 24 Jun 2024 17:56:14 +0200 Subject: [PATCH 2/2] Update gef.py Co-authored-by: crazy hugsy --- gef.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gef.py b/gef.py index 38bfa1951..b2e02dfee 100644 --- a/gef.py +++ b/gef.py @@ -493,7 +493,7 @@ def wrapper(*args: Any, **kwargs: Any) -> Callable: continue elif argtype in (list, tuple): parser.add_argument(*argname, type=type(argvalue[0]), - default=[], action='append') + default=[], action="append") continue parser.add_argument(*argname, type=argtype, default=argvalue)