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:
parent
7bf1fd6716
commit
d4b89f16e3
1 changed files with 13 additions and 6 deletions
|
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue