Skip to content
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

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/commands/CmdModify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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'.");
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'.

}

if (words.at (0) == "start")
Expand All @@ -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));
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 (ids.empty ())
Expand Down