Skip to content

Commit bcdbf4f

Browse files
committed
Optional prompts to avoid super long commands.
1 parent cb589fa commit bcdbf4f

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

cli.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,15 +193,18 @@ def clockin(
193193
),
194194
hours: float = typer.Option(
195195
None,
196-
help = "Log a completed task that took this many hours."
196+
help = "Log a completed task that took this many hours.",
197+
prompt = "How many hours? (Type '0' if task is active)"
197198
),
198199
date: str = typer.Option(
199200
None,
200-
help = "Force date. Use this is if you started but forgot to clock in."
201+
help = "Force date. Use this is if you started but forgot to clock in.",
202+
prompt = "What date and time? (Enter 'no' if not forcing)"
201203
),
202204
deliver: str = typer.Option(
203205
None,
204-
help = "Add a delivery, typically if clocking in a past event."
206+
help = "Add a delivery, typically if clocking in a past event.",
207+
prompt = "Deliverable? (Enter 'no' if none)"
205208
),
206209
titlecase: bool = typer.Option(
207210
None,
@@ -229,6 +232,11 @@ def clockin(
229232
# If not explicitly false, use title case
230233
task = utils.capitalize_title(task) if titlecase else task
231234

235+
# Handle optional prompts
236+
if hours == 0: hours = None
237+
if date.lower().strip() == "no": date = None
238+
if deliver.lower().strip() == "no": deliver = None
239+
232240
# Check for multiple unfinished tasks
233241
tasks = work_log.fetch(
234242
{

0 commit comments

Comments
 (0)