mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Refactor CmdMove: Fail early if no id given
This commit is contained in:
parent
35e5098b51
commit
ecb8aa447c
1 changed files with 6 additions and 11 deletions
|
@ -42,19 +42,17 @@ int CmdMove (
|
|||
std::vector<int> ids = cli.getIds();
|
||||
|
||||
if (ids.size() > 1)
|
||||
throw std::string ("The 'move' command only supports a single ID.");
|
||||
|
||||
int id;
|
||||
{
|
||||
throw std::string("The 'move' command only supports a single ID.");
|
||||
}
|
||||
|
||||
if (ids.empty())
|
||||
{
|
||||
id = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
id = ids[0];
|
||||
throw std::string ("ID must be specified. See 'timew help move'.");
|
||||
}
|
||||
|
||||
int id = ids[0];
|
||||
|
||||
std::string new_start;
|
||||
for (auto& arg : cli._args)
|
||||
{
|
||||
|
@ -62,9 +60,6 @@ int CmdMove (
|
|||
new_start = arg.attribute ("raw");
|
||||
}
|
||||
|
||||
if (! id)
|
||||
throw std::string ("ID must be specified. See 'timew help move'.");
|
||||
|
||||
// Load the data.
|
||||
// Note: There is no filter.
|
||||
Interval filter;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue