diff --git a/CHANGES.txt b/CHANGES.txt index 32db38d..a775ed5 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,41 +1,45 @@ -Recent tagged changes as of 2025-01-03 21:52:25.082522: -- 0 seconds ago (HEAD -> working, tag: 0.0.22) Daniel Graham +Recent tagged changes as of 2025-01-04 09:16:42.305231: +- 0 seconds ago (HEAD -> working, tag: 0.0.23) Daniel Graham + 62cbfe8 2025-01-04 09:16:42 -0500 + Tagged version 0.0.23. + +- 11 hours ago (tag: 0.0.22) Daniel Graham f4a44d3 2025-01-03 21:52:25 -0500 Tagged version 0.0.22. -- 15 hours ago (tag: 0.0.21) Daniel Graham +- 26 hours ago (tag: 0.0.21) Daniel Graham f77ff68 2025-01-03 06:52:19 -0500 Tagged version 0.0.21. -- 9 days ago (tag: 0.0.20) Daniel Graham +- 10 days ago (tag: 0.0.20) Daniel Graham a93e205 2024-12-25 13:57:20 -0500 Tagged version 0.0.20. -- 9 days ago (tag: 0.0.19) Daniel Graham +- 10 days ago (tag: 0.0.19) Daniel Graham 65cd59a 2024-12-25 13:37:41 -0500 Tagged version 0.0.19. -- 9 days ago (tag: 0.0.18) Daniel Graham +- 10 days ago (tag: 0.0.18) Daniel Graham d202d08 2024-12-25 13:12:30 -0500 Tagged version 0.0.18. -- 9 days ago (tag: 0.0.17) Daniel Graham +- 10 days ago (tag: 0.0.17) Daniel Graham f8677ea 2024-12-25 13:05:29 -0500 Tagged version 0.0.17. -- 9 days ago (tag: 0.0.16) Daniel Graham +- 10 days ago (tag: 0.0.16) Daniel Graham 040ad27 2024-12-25 12:56:14 -0500 Tagged version 0.0.16. -- 10 days ago (tag: 0.0.15) Daniel Graham +- 11 days ago (tag: 0.0.15) Daniel Graham 051142c 2024-12-24 13:24:38 -0500 Tagged version 0.0.15. -- 10 days ago (tag: 0.0.14) Daniel Graham +- 11 days ago (tag: 0.0.14) Daniel Graham 8776f71 2024-12-24 13:15:27 -0500 Tagged version 0.0.14. -- 13 days ago (tag: 0.0.13) Daniel Graham +- 2 weeks ago (tag: 0.0.13) Daniel Graham da57786 2024-12-21 12:10:43 -0500 Tagged version 0.0.13. @@ -67,14 +71,10 @@ Recent tagged changes as of 2025-01-03 21:52:25.082522: a68ba30 2024-12-18 11:13:47 -0500 Tagged version 0.0.6. -- 2 weeks ago (tag: 0.0.5) Daniel Graham +- 3 weeks ago (tag: 0.0.5) Daniel Graham b533dc9 2024-12-17 20:39:45 -0500 Tagged version 0.0.5. -- 2 weeks ago (tag: 0.0.4) Daniel Graham +- 3 weeks ago (tag: 0.0.4) Daniel Graham 4a0e95e 2024-12-17 15:21:38 -0500 Tagged version 0.0.4. - -- 2 weeks ago (tag: 0.0.3) Daniel Graham - ee202ca 2024-12-17 14:52:52 -0500 - Tagged version 0.0.3. diff --git a/modules/__version__.py b/modules/__version__.py index da5ba2a..b05be91 100755 --- a/modules/__version__.py +++ b/modules/__version__.py @@ -1 +1 @@ -version = '0.0.22' \ No newline at end of file +version = '0.0.23' \ No newline at end of file diff --git a/modules/timemate.py b/modules/timemate.py index 0088ad6..5547128 100644 --- a/modules/timemate.py +++ b/modules/timemate.py @@ -391,6 +391,21 @@ def timer_new(): # Resolve selection to account_id account_id = account_completions.get(selection.lower()) if not account_id: # If input is a new account name + confirm_message = ( + f"Account '{selection}' does not exist. Do you want to create it? [y/n]: " + ) + + try: + confirm = session.prompt(confirm_message, completer=None, default="n").strip().lower() + if confirm != "y": + console.print("[yellow]Account creation cancelled by user.[/yellow]") + conn.close() + return + except KeyboardInterrupt: + console.print("[red]Operation cancelled by user.[/red]") + conn.close() + return + cursor.execute("INSERT INTO Accounts (account_name) VALUES (?)", (selection,)) conn.commit() console.print( @@ -399,10 +414,11 @@ def timer_new(): console.print() account_id = cursor.lastrowid + # Prompt for memo (optional) try: memo = session.prompt( - "Enter a memo to describe the time spent (optional): ", default="" + "Enter a memo to describe the time spent (optional): ", completer=None, default="" ) except KeyboardInterrupt: console.print("[red]Cancelled by user.[/red]") @@ -425,7 +441,7 @@ def timer_new(): try: default = datetime.datetime.now().strftime("%y-%m-%d %H:%M") new_datetime_input = session.prompt( - f"Enter datetime (datetime string) [{default}]: ", + f"Enter datetime (datetime string) [{default}]: ", completer=None, default=default, ) new_datetime = ( @@ -592,7 +608,7 @@ def timer_update(position): # Prompt for memo try: new_memo = session.prompt( - f"Enter memo [{current_memo or ''}]: ", default=current_memo or "" + f"Enter memo [{current_memo or ''}]: ", completer=None, default=current_memo or "" ) except KeyboardInterrupt: console.print("[red]Operation cancelled by user.[/red]") @@ -603,7 +619,7 @@ def timer_update(position): try: default = seconds_to_time(int(current_timedelta)) new_timedelta = session.prompt( - f"Enter elapsed time (time string) [{default}]: ", + f"Enter elapsed time (time string) [{default}]: ", completer=None, default=default, ) new_timedelta = time_to_seconds(new_timedelta) @@ -615,7 +631,7 @@ def timer_update(position): # Prompt for datetime try: new_datetime_input = session.prompt( - f"Enter datetime (datetime string) [{current_datetime_str}]: ", + f"Enter datetime (datetime string) [{current_datetime_str}]: ", completer=None, default=current_datetime_str, ) new_datetime = ( @@ -1107,7 +1123,7 @@ def report_account(tree): try: start_date_input = session.prompt( "Enter starting month (YY-MM) (press Enter to include all months): ", - default="", + default="", completer=None, ) start_date = ( datetime.datetime.strptime(start_date_input, "%y-%m") @@ -1143,7 +1159,7 @@ def report_account(tree): # Prompt for optional ending month if start_date is given try: end_date_input = session.prompt( - "Enter ending month (YY-MM) (press Enter to use the same as starting month): ", + "Enter ending month (YY-MM) (press Enter to use the same as starting month): ", completer=None, default=start_date.strftime("%y-%m"), ) end_date = datetime.datetime.strptime(end_date_input, "%y-%m")