Skip to content

Commit e7cf185

Browse files
fix: badly handled sys.argv was duplicating args
Signed-off-by: thiswillbeyourgithub <[email protected]>
1 parent cfff0ac commit e7cf185

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

wdoc/__main__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,9 @@ def cli_launcher() -> None:
271271
if len([c for c in candidates if c == "user_query"]) == 1:
272272
query_index = candidates.index("user_query")
273273
kwargs["query"] = args.pop(query_index)
274-
sys.argv.append(f"--query='{kwargs['query']}'")
274+
sys.argv[sys.argv.index(kwargs["query"])] = (
275+
f"--query='{kwargs['query']}'"
276+
)
275277
candidates.pop(query_index)
276278

277279
if (
@@ -281,7 +283,7 @@ def cli_launcher() -> None:
281283
and candidates[0]
282284
):
283285
kwargs["path"] = args.pop(0)
284-
sys.argv.append(f"--path='{kwargs['path']}'")
286+
sys.argv[sys.argv.index(kwargs["path"])] = f"--path='{kwargs['path']}'"
285287

286288
# if args is not empty, we have not succesfully parsed everything
287289
if args:

0 commit comments

Comments
 (0)