From ec5ff4744925591e132147868472683a615a11b6 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 1 Nov 2021 12:00:48 +0100 Subject: [PATCH] Refactor options --- options.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/options.py b/options.py index 8a12439..faa29e1 100644 --- a/options.py +++ b/options.py @@ -30,7 +30,10 @@ class Options: def init(): opt = Options() - parse_cmdline_args(opt) + + parser = argparse.ArgumentParser() + create_cmdline_args(parser) + parse_cmdline_args(parser, opt) if opt.dryrun: dryrun_show_options(opt) return opt @@ -40,8 +43,7 @@ def dryrun_show_options(options): print(options) -def parse_cmdline_args(options): - parser = argparse.ArgumentParser() +def create_cmdline_args(parser): parser.add_argument( "-n", "--dryrun", help="only simulate and print changes", action="store_true" ) @@ -71,6 +73,9 @@ def parse_cmdline_args(options): help="don't add ideas as maybe items to taskwarrior", action="store_true", ) + + +def parse_cmdline_args(parser, options): args = parser.parse_args() if args.dryrun: