Rename command line argument holder
This commit is contained in:
parent
381cbd7a36
commit
464cf85680
|
@ -151,29 +151,28 @@ def create_progress():
|
|||
|
||||
def main():
|
||||
"""CLI command."""
|
||||
cli = docopt.docopt(__doc__, sys.argv[1:], version=__version__)
|
||||
print(cli)
|
||||
args = docopt.docopt(__doc__, sys.argv[1:], version=__version__)
|
||||
|
||||
try:
|
||||
target_id, www_lang = www.parse_url(cli.URL)
|
||||
target_id, www_lang = www.parse_url(args["URL"])
|
||||
|
||||
http_session = requests.sessions.Session()
|
||||
|
||||
sources = fetch_sources(http_session, target_id, www_lang)
|
||||
|
||||
if not cli["RENDITION"]:
|
||||
if not args["RENDITION"]:
|
||||
print(f"Available renditions:")
|
||||
_print_renditions(sources)
|
||||
return 0
|
||||
|
||||
sources = _select_rendition(sources, cli["RENDITION"])
|
||||
sources = _select_rendition(sources, args["RENDITION"])
|
||||
|
||||
if not cli["VARIANT"]:
|
||||
if not args["VARIANT"]:
|
||||
print(f"Available variants:")
|
||||
_print_variants(sources)
|
||||
return 0
|
||||
|
||||
sources = _select_variant(sources, cli["VARIANT"])
|
||||
sources = _select_variant(sources, args["VARIANT"])
|
||||
|
||||
file_names = [
|
||||
naming.build_file_name(s, i, len(sources)) for i, s in enumerate(sources, 1)
|
||||
|
@ -203,13 +202,13 @@ def main():
|
|||
|
||||
except error.ModuleError as e:
|
||||
print(str(e))
|
||||
if cli["--debug"]:
|
||||
if args["--debug"]:
|
||||
print(repr(e))
|
||||
return 1
|
||||
|
||||
except requests.HTTPError as e:
|
||||
print("Network error.")
|
||||
if cli["--debug"]:
|
||||
if args["--debug"]:
|
||||
print(str(e))
|
||||
return 1
|
||||
|
||||
|
|
Loading…
Reference in New Issue