fixed some bugs in todo add and made todo print ls after todo done
This commit is contained in:
@@ -212,7 +212,8 @@ def cmd_add(args):
|
||||
entry = ' '.join(args.text)
|
||||
if not entry.startswith('[#'):
|
||||
console.print('[yellow]No priority; defaulting to Med (B).[/]')
|
||||
entry = '[#B] ' + entry
|
||||
today = date.today().strftime(DATE_FORMAT)
|
||||
entry = f"[#{DEFAULT_PRIORITY}] ({today}) {entry}"
|
||||
if '@' not in entry:
|
||||
console.print('[yellow]No tag; defaulting to @misc.[/]')
|
||||
entry += ' @misc'
|
||||
@@ -222,6 +223,8 @@ def cmd_add(args):
|
||||
tasks.append(t)
|
||||
write_tasks(tasks)
|
||||
console.print(f'[green]Added:[/] {t.description}')
|
||||
else:
|
||||
console.print(f'[red]Failed to parse task line:[/] {entry}')
|
||||
else:
|
||||
desc = Prompt.ask('Task description')
|
||||
prio = Prompt.ask('Priority (A=High,B=Med,C=Low)', choices=['A','B','C'], default=DEFAULT_PRIORITY)
|
||||
@@ -243,6 +246,7 @@ def cmd_done(args):
|
||||
all_tasks[idx] = all_tasks[idx].mark_done()
|
||||
write_tasks(all_tasks)
|
||||
console.print(f"[green]Completed:[/] {all_tasks[idx].description}")
|
||||
cmd_ls(argparse.Namespace(sort=None))
|
||||
except:
|
||||
console.print('[red]Invalid task number[/]')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user