timetrap icon indicating copy to clipboard operation
timetrap copied to clipboard

Throw an error on unknown arguments

Open ag-TJNII opened this issue 6 months ago • 1 comments

I've lost count of how many times I've done this:

$ t edit -i 308 --out 14:00
Editing entry with id 308

Timesheet: 20250818
    Day                Start      End        Duration   Notes
    Thu Aug 21, 2025   11:30:00 - 13:00:00   1:30:00    --out 14:00
                                             1:30:00
    ---------------------------------------------------------------
    Total                                    1:30:00

I think it's unlikely for Notes to start with - and more likely the user is confusing option arguments. I don't need to edit often so the fact that it's t in normally but t edit --start (and t out / t edit --end) always trips me. In the case of passing a bad option argument I'd prefer to get an error, not replace my note with junk. I think it would be helpful for this utility to treat arguments starting with - as an option. If users to need to start a note with - then the -- "end of options" marker, which is a POSIX guideline, is the solution.

https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02

ag-TJNII avatar Aug 21 '25 22:08 ag-TJNII

Great suggestion. I know I’ve personally made that mistake many times 😅. PR’s are welcome.

dechimp avatar Aug 21 '25 23:08 dechimp