diff options
Diffstat (limited to 'audiobook.py')
| -rwxr-xr-x | audiobook.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/audiobook.py b/audiobook.py index 5569070..f95e1d3 100755 --- a/audiobook.py +++ b/audiobook.py @@ -371,11 +371,14 @@ Examples: if args.backend != BACKEND_AUDIOCPP: parser.error("--option requires --backend audiocpp; the options " "are passed through to the audio.cpp model") - for item in args.option: - key, sep, value = item.partition("=") - if not sep or not key.strip(): - parser.error(f"--option expects KEY=VALUE (got {item!r})") - request_options[key.strip()] = value + from backends.common import parse_request_options + try: + # Joined with spaces so both "--option a=1 --option b=2" and a + # single quoted "a=1, b=2" parse identically (the shared parser + # splits on commas or whitespace). + request_options = parse_request_options(" ".join(args.option)) + except ValueError as exc: + parser.error(str(exc)) api_url = None if args.api_url is not None: |
