Skip to content

Conversation

@patdavid
Copy link

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.

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]>
Copy link
Member

@lauft lauft left a 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...

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));
Copy link
Member

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'.

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'.");
Copy link
Member

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'.

@lauft lauft added the enhancement New feature or request label Jun 11, 2021
@lauft
Copy link
Member

lauft commented Jul 14, 2021

@patdavid Will there be any update from your side? Otherwise I would just merge your work with the suggested changes myself...

@patdavid
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev-branch enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants