import os import argparse from dataclasses import dataclass @dataclass class Options: jrnl_fname: str = f"{os.path.expanduser('~')}/documents/records/todo.md" todo_block_title: str = "todotxt" dryrun: bool = False taskwarrior_log_done: bool = True def init(): opt = Options() parse_cmdline_args(opt) print_dryrun(opt) return opt def print_dryrun(options): print(options) def parse_cmdline_args(options): parser = argparse.ArgumentParser() parser.add_argument( "-n", "--dryrun", help="only simulate and print changes", action="store_true" ) parser.add_argument("-f", "--file", help="the jrnl file to ingest") parser.add_argument("-b", "--blocktitle", help="the jrnl file to ingest") parser.add_argument( "-L", "--nologging", help="don't log done todo items to taskwarrior", action="store_true", ) args = parser.parse_args() if args.dryrun: options.dryrun = True if args.nologging: options.taskwarrior_log_done = False if args.file: options.jrnl_fname = args.file if args.blocktitle: options.todo_block_title = args.blocktitle return options