From 5522bc0d9b69dfb07988b3b2596dbd6ad7ee5ca8 Mon Sep 17 00:00:00 2001 From: Qichen Liu Date: Tue, 9 Apr 2024 00:17:43 +0200 Subject: [PATCH] v1.20: add --version flag --- setup.py | 2 +- todoism/cli.py | 1 + todoism/main.py | 2 ++ todoism/print.py | 3 +++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4831447..0c18f50 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='todoism', - version='1.19', + version='1.20', packages=find_packages(exclude=['test']), package_dir={'todoism': 'todoism'}, entry_points={ diff --git a/todoism/cli.py b/todoism/cli.py index ee29331..f692201 100644 --- a/todoism/cli.py +++ b/todoism/cli.py @@ -7,6 +7,7 @@ def parse_args(): parser.add_argument("-d", "--delete", metavar="ID", type=validate_id, help="delete todo by id") parser.add_argument("-p", "--print-all", action="store_true", help="print all todos") parser.add_argument("-f", "--flag", action="store_true", help="set task as flagged (used with '-a')") + parser.add_argument("-v", "--version", action="store_true", help="show todoism version") return parser.parse_args() def validate_id(arg): diff --git a/todoism/main.py b/todoism/main.py index 10b2638..c24ff0e 100644 --- a/todoism/main.py +++ b/todoism/main.py @@ -221,6 +221,8 @@ def run(): elif args.print_all: todos = tsk.load_tasks() pr.print_all_cli(todos) + elif args.version: + pr.print_version() else: curses.wrapper(main) diff --git a/todoism/print.py b/todoism/print.py index f88f17b..fe50373 100644 --- a/todoism/print.py +++ b/todoism/print.py @@ -53,6 +53,9 @@ def print_msg(stdscr, msg): stdscr.addstr(1, 0, f"{final_str}") stdscr.refresh() +def print_version(): + print("todoism version 1.20") + # The core function to print a single task def print_task(stdscr, task, y): max_y, max_x= stdscr.getmaxyx()