Skip to content

Commit

Permalink
v1.20: add --version flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Q1CHENL committed Apr 8, 2024
1 parent 31b60d6 commit 5522bc0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='todoism',
version='1.19',
version='1.20',
packages=find_packages(exclude=['test']),
package_dir={'todoism': 'todoism'},
entry_points={
Expand Down
1 change: 1 addition & 0 deletions todoism/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 2 additions & 0 deletions todoism/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 3 additions & 0 deletions todoism/print.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 5522bc0

Please sign in to comment.