Refactor arguments parsing

And change some defaults
master
Lertsenem 2020-07-21 00:35:56 +02:00
parent 8b61e6b8a6
commit 2ea7b3afc4
1 changed files with 14 additions and 11 deletions

View File

@ -21,21 +21,26 @@ ROOTDIR = os.path.dirname(os.path.abspath(__file__))
def main(): def main():
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(
formatter_class = argparse.ArgumentDefaultsHelpFormatter,
)
subparsers = parser.add_subparsers( subparsers = parser.add_subparsers(
dest = "command", dest = "command",
help = "commands", help = "commands",
) )
parser.add_argument( "--proxy", "-p", parser.add_argument(
default = None, "--proxy", "-p",
help = "the proxy to use" ) default = None,
help = "the proxy to use",
parser.add_argument( "--token", "-t", )
default = None,
help = "the authentication token to use" )
parser.add_argument(
"--token", "-t",
default = None,
help = "the authentication token to use",
)
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
init_parser = subparsers.add_parser( init_parser = subparsers.add_parser(
@ -83,7 +88,7 @@ def main():
) )
top8_parser.add_argument( top8_parser.add_argument(
"--template", "-T", "--template", "-T",
default = "rebootlyon", default = "rebootlyon2020",
help = "The local result template to use", help = "The local result template to use",
) )
top8_parser.add_argument( top8_parser.add_argument(
@ -92,14 +97,12 @@ def main():
help = "The lkrz file in which the results are stored ; if it " \ help = "The lkrz file in which the results are stored ; if it " \
"does not exist, one will be created from the smashgg data", "does not exist, one will be created from the smashgg data",
) )
top8_parser.add_argument( top8_parser.add_argument(
"--outfile", "-o", "--outfile", "-o",
default = None, default = None,
help = "The SVG local result file to output to ; defaults to " \ help = "The SVG local result file to output to ; defaults to " \
"./tournament-slug.svg", "./tournament-slug.svg",
) )
top8_parser.add_argument( top8_parser.add_argument(
"--name-seo-delimiter", "--name-seo-delimiter",
default = None, default = None,