-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add usage to modify command #429
base: dev
Are you sure you want to change the base?
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 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I have some suggestions for the error messages you may take into consideration...
@@ -59,7 +59,7 @@ int CmdModify ( | |||
} | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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'.
@@ -46,7 +46,7 @@ int CmdModify ( | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.