fix(scripts): backfill arg parser consumed --workers value as LIMIT

'--workers 3' set limit=3 because the bare '3' also hit the isdigit() branch.
Skip flag-value positions when scanning for a positional LIMIT.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
jtrzupek 2026-06-08 10:15:09 +02:00
parent 7bf1fd6716
commit d4b89f16e3

View file

@ -44,13 +44,20 @@ def _args() -> tuple[int, bool, int, float]:
commit = "--commit" in sys.argv commit = "--commit" in sys.argv
workers = 3 workers = 3
sleep = 0.3 sleep = 0.3
for i, a in enumerate(sys.argv[1:], 1): argv = sys.argv[1:]
if a.isdigit(): skip = False
for i, a in enumerate(argv):
if skip: # ta pozycja to wartość poprzedniej flagi (--workers/--sleep) — nie traktuj jako LIMIT
skip = False
continue
if a == "--workers" and i + 1 < len(argv):
workers = int(argv[i + 1]); skip = True
elif a == "--sleep" and i + 1 < len(argv):
sleep = float(argv[i + 1]); skip = True
elif a == "--commit":
continue
elif a.isdigit():
limit = int(a) limit = int(a)
elif a == "--workers" and i < len(sys.argv) - 1:
workers = int(sys.argv[i + 1])
elif a == "--sleep" and i < len(sys.argv) - 1:
sleep = float(sys.argv[i + 1])
return limit, commit, workers, sleep return limit, commit, workers, sleep