Refactor CmdMove: Fail early if no id given

This commit is contained in:
Thomas Lauf 2018-01-05 14:27:25 +01:00
parent 35e5098b51
commit ecb8aa447c

View file

@ -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;