mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
CmdGet: Checks all references before emitting results
This commit is contained in:
parent
d8bfeea142
commit
14ca159df4
1 changed files with 5 additions and 4 deletions
|
@ -27,18 +27,18 @@
|
||||||
#include <cmake.h>
|
#include <cmake.h>
|
||||||
#include <commands.h>
|
#include <commands.h>
|
||||||
#include <timew.h>
|
#include <timew.h>
|
||||||
|
#include <shared.h>
|
||||||
#include <format.h>
|
#include <format.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Іdentify DOM references in cli, provide space-separated results.
|
||||||
int CmdGet (
|
int CmdGet (
|
||||||
const CLI& cli,
|
const CLI& cli,
|
||||||
Rules& rules,
|
Rules& rules,
|
||||||
Database& database)
|
Database& database)
|
||||||
{
|
{
|
||||||
// TODO Join results together with spaces.
|
std::vector <std::string> results;
|
||||||
|
|
||||||
// Іdentify DOM references in cli.
|
|
||||||
for (auto& arg : cli._args)
|
for (auto& arg : cli._args)
|
||||||
{
|
{
|
||||||
if (arg.hasTag ("TAG") &&
|
if (arg.hasTag ("TAG") &&
|
||||||
|
@ -49,10 +49,11 @@ int CmdGet (
|
||||||
if (! domGet (database, reference, value))
|
if (! domGet (database, reference, value))
|
||||||
throw format ("DOM reference '{1}' is not valid.", reference);
|
throw format ("DOM reference '{1}' is not valid.", reference);
|
||||||
|
|
||||||
std::cout << value << '\n';
|
results.push_back (value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::cout << join (" ", results) << '\n';
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue