uncurl icon indicating copy to clipboard operation
uncurl copied to clipboard

Abnormal exit when empty string is passed to uncurl.parse_context()

Open costis-t opened this issue 4 years ago • 0 comments

When an empty string (curl_command = '') is passed to uncurl.parse_context(curl_command) a python script ends abnormally showing this error:

usage: [-h] [-d DATA] [-b DATA_BINARY] [-X X] [-H HEADER] [--compressed] [-k] [--user USER] [-i] [-s] command url
: error: the following arguments are required: command, url

The abnormal termination could be fixed with something like

    try:
        parsed_args = parser.parse_args(tokens)
    except:
        pass

in https://github.com/spulec/uncurl/blob/16d0568b7c2d1bd427a524f00764bab3c954bcd0/uncurl/api.py#L36

costis-t avatar Mar 06 '22 22:03 costis-t