Add usage to modify command#429
Conversation
This commit adds the usage line from the manpage to the modify command for quick reference when called without parameters: ``` $ timew modify Usage: timew modify ( start | end ) <id> <date> Must specify start|end command to modify. See 'timew help modify'. ``` This makes it faster than looking up the syntax in the manpage and helps build faster memory of syntax for users. Signed-off-by: Pat David <patdavid@gmail.com>
lauft
left a comment
There was a problem hiding this comment.
Good idea. I have some suggestions for the error messages you may take into consideration...
| else | ||
| { | ||
| throw format ("Must specify start|end command to modify. See 'timew help modify'.", words.at (0)); | ||
| throw format ("Usage: timew modify ( start | end ) <id> <date>\nMust specify start|end command to modify. See 'timew help modify'.", words.at (0)); |
There was a problem hiding this comment.
I noticed that here the format function does not use the words.at (0) parameter at all.
I think we should change this to something like
Unknown sub-command '{}'!
Usage: timew modify ( start | end ) <id> <date>
Please add the start/end sub-command to 'modify'. See 'timew help modify'.
In action:
$ timew modify strat @2
Unknown sub-command 'strat'!
Usage: timew modify ( start | end ) <id> <date>
Please add the start/end sub-command to 'modify'. See 'timew help modify'.
| if (words.empty()) | ||
| { | ||
| throw std::string ("Must specify start|end command to modify. See 'timew help modify'."); | ||
| throw std::string ("Usage: timew modify ( start | end ) <id> <date>\nMust specify start|end command to modify. See 'timew help modify'."); |
There was a problem hiding this comment.
Maybe we can also add some info what went wrong:
Missing sub-command!
Usage: timew modify ( start | end ) <id> <date>
Please add the start/end sub-command to 'modify'. See 'timew help modify'.
e.g.:
$ timew modify @4
Missing sub-command!
Usage: timew modify ( start | end ) <id> <date>
Please add the start/end sub-command to 'modify'. See 'timew help modify'.
|
@patdavid Will there be any update from your side? Otherwise I would just merge your work with the suggested changes myself... |
|
Ah, sorry - this slipped out of memory for me. :( (sorry!) I don't have anything else to add at the moment, although I'm happy to revisit this when I can carve out a little more time and maybe propagate the idea to the rest of the commands for more helpful messages. |
This commit adds the usage line from the manpage to the modify
command for quick reference when called without parameters:
This makes it faster than looking up the syntax in the manpage and
helps build faster memory of syntax for users.