Skip to content

Commit

Permalink
added some spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
dixls committed May 22, 2023
1 parent 325a3e6 commit 1252ac5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
choices=statuses,
help="give your item a status, to-do, in-progress, waiting, done",
)
parser.add_argument(
"-t", "--title", type=str, help="change the title of an item when editing"
)
parser.add_argument("-d", "--done", type=int, help="quickly mark an item done")


Expand All @@ -40,6 +43,7 @@

args = parser.parse_args()

spacing = "%4s %40s %10s %10s"

if args.done:
todo_item = session.query(Item).filter_by(id=args.done).first()
Expand Down Expand Up @@ -69,12 +73,19 @@
if args.status:
s = args.status
todo_item.status = statuses.index(s)
if args.title:
todo_item.title = args.title
session.add(todo_item)
session.commit()
print(f"changed item {todo_item.id}")

else:
items = (
session.query(Item).order_by(Item.status.desc()).order_by(Item.priority.desc())
)
print(spacing % ("Id", "Title", "Priority", "Status"))
for item in items:
print(item.id, item.title, priorities[item.priority], statuses[item.status])
print(
spacing
% (item.id, item.title, priorities[item.priority], statuses[item.status])
)

0 comments on commit 1252ac5

Please sign in to comment.