From f850e0946ba436b2e475c4bea6b55aec7cb8c853 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 22 Aug 2015 11:02:35 -0400 Subject: [PATCH] CmdUnique: Converted to use CLI2::getWords --- src/commands/CmdUnique.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/commands/CmdUnique.cpp b/src/commands/CmdUnique.cpp index d4d3dc5fb..34681ccd4 100644 --- a/src/commands/CmdUnique.cpp +++ b/src/commands/CmdUnique.cpp @@ -42,7 +42,7 @@ CmdUnique::CmdUnique () _keyword = "_unique"; _usage = "task _unique "; _description = STRING_CMD_UNIQUE_USAGE; - _read_only = false; + _read_only = true; _displays_id = true; _needs_gc = true; _uses_context = true; @@ -63,20 +63,12 @@ int CmdUnique::execute (std::string& output) // Find . std::string attribute = ""; - for (auto& a : context.cli2._args) - { - if ((a._lextype == Lexer::Type::word || - a._lextype == Lexer::Type::dom) && - a.hasTag ("MODIFICATION")) - { - // Stop at first matching arg. - attribute = a.attribute ("raw"); - break; - } - } - if (attribute == "") + // Just the first arg. + auto words = context.cli2.getWords (); + if (words.size () == 0) throw std::string (STRING_CMD_UNIQUE_MISSING); + attribute = words[0]; std::string canonical; if (! context.cli2.canonicalize (canonical, "attribute", attribute))