Refactor options
This commit is contained in:
parent
c6cb3dd6c3
commit
ec5ff47449
1 changed files with 8 additions and 3 deletions
11
options.py
11
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:
|
||||
|
|
Loading…
Reference in a new issue