From 14ca159df40ec61161d4ef20b3fcbccdfee9fc12 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 16 Jul 2016 11:12:47 -0400 Subject: [PATCH] CmdGet: Checks all references before emitting results --- src/commands/CmdGet.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/commands/CmdGet.cpp b/src/commands/CmdGet.cpp index 5bcedc72..9ea2e5d9 100644 --- a/src/commands/CmdGet.cpp +++ b/src/commands/CmdGet.cpp @@ -27,18 +27,18 @@ #include #include #include +#include #include #include //////////////////////////////////////////////////////////////////////////////// +// Іdentify DOM references in cli, provide space-separated results. int CmdGet ( const CLI& cli, Rules& rules, Database& database) { - // TODO Join results together with spaces. - - // Іdentify DOM references in cli. + std::vector results; for (auto& arg : cli._args) { if (arg.hasTag ("TAG") && @@ -49,10 +49,11 @@ int CmdGet ( if (! domGet (database, reference, value)) throw format ("DOM reference '{1}' is not valid.", reference); - std::cout << value << '\n'; + results.push_back (value); } } + std::cout << join (" ", results) << '\n'; return 0; }