From 99ccc585d15ee1cd5d1a9b181df94e74475590d8 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Mon, 11 Dec 2023 16:05:28 +0100 Subject: [PATCH] Streamline command line arguments and documentation. (#10) --- CHANGES.rst | 2 +- README.rst | 2 +- gtimelog2tick.py | 19 ++++++++++--------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 91282e3..f47b638 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,7 @@ Change log 0.3 (unreleased) ================ -- Nothing changed yet. +- Streamline command line arguments and documentation. 0.2 (2023-12-11) diff --git a/README.rst b/README.rst index de4a53f..7c0091a 100644 --- a/README.rst +++ b/README.rst @@ -20,7 +20,7 @@ Installation with pipx .. code-block:: sh - pipx install . + pipx install gtimelog2tick Usage ===== diff --git a/gtimelog2tick.py b/gtimelog2tick.py index 32d922a..25983f8 100755 --- a/gtimelog2tick.py +++ b/gtimelog2tick.py @@ -425,8 +425,7 @@ def __call__(self, value): def show_results( entries: Iterable[TickSyncStatus], - stdout, - verbose=0): + stdout): totals = { 'hours': collections.defaultdict(int), 'entries': collections.defaultdict(int), @@ -451,10 +450,12 @@ def show_results( def _main(argv=None, stdout=sys.stdout): - parser = argparse.ArgumentParser() - parser.add_argument('-c', '--config', default='~/.gtimelog/gtimelogrc') - parser.add_argument('-v', '--verbose', action='count', default=0, - help='be more verbose (can be repeated)') + parser = argparse.ArgumentParser( + epilog='--since and --until also understand the arguments today as' + ' well as yesterday') + parser.add_argument( + '-c', '--config', default='~/.gtimelog/gtimelogrc', + help='path of the config file, defaults to ~/.gtimelog/gtimelogrc') parser.add_argument( '--dry-run', action='store_true', @@ -466,8 +467,8 @@ def _main(argv=None, stdout=sys.stdout): " minus 7 days") parser.add_argument( '--until', type=Date(), - help="sync logs up until specified yyyy-mm-dd date, it does _not_" - " include the specified day.") + help="sync logs until specified yyyy-mm-dd date, it does _not_" + " include the specified day, there is no default.") args = parser.parse_args(argv) if args.since and args.until and args.since >= args.until: @@ -487,7 +488,7 @@ def _main(argv=None, stdout=sys.stdout): entries = filter_timelog(entries, since=args.since, until=args.until) entries = sync_with_tick(config, entries, dry_run=args.dry_run) entries = log_tick_sync(entries, config['ticklog']) - show_results(entries, stdout, verbose=args.verbose) + show_results(entries, stdout) def main(argv=None, stdout=sys.stdout):