CmdGet: Checks all references before emitting results

This commit is contained in:
Paul Beckingham 2016-07-16 11:12:47 -04:00
parent d8bfeea142
commit 14ca159df4

View file

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