From 76760fe434a0d3795edc01309bad82212fa6b27a Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 1 Aug 2011 01:18:12 -0400 Subject: [PATCH] Command - show - Fixed the show command to accept 'all' or a substring to search for in the configuration file. --- src/E9.cpp | 8 ++++++++ src/commands/CmdShow.cpp | 12 ++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/E9.cpp b/src/E9.cpp index b41f58f7a..67fc08a99 100644 --- a/src/E9.cpp +++ b/src/E9.cpp @@ -297,12 +297,14 @@ void E9::operator_lt (Term& result, Term& left, Term& right) result._category = "bool"; +/* std::cout << "# " << left._raw << "/" << left._value << "/" << left._category << " < " << right._raw << "/" << right._value << "/" << right._category << " --> " << result._raw << "/" << result._value << "/" << result._category << "\n"; +*/ } //////////////////////////////////////////////////////////////////////////////// @@ -326,12 +328,14 @@ void E9::operator_lte (Term& result, Term& left, Term& right) result._category = "bool"; +/* std::cout << "# " << left._raw << "/" << left._value << "/" << left._category << " <= " << right._raw << "/" << right._value << "/" << right._category << " --> " << result._raw << "/" << result._value << "/" << result._category << "\n"; +*/ } //////////////////////////////////////////////////////////////////////////////// @@ -355,12 +359,14 @@ void E9::operator_gte (Term& result, Term& left, Term& right) result._category = "bool"; +/* std::cout << "# " << left._raw << "/" << left._value << "/" << left._category << " >= " << right._raw << "/" << right._value << "/" << right._category << " --> " << result._raw << "/" << result._value << "/" << result._category << "\n"; +*/ } //////////////////////////////////////////////////////////////////////////////// @@ -383,12 +389,14 @@ void E9::operator_gt (Term& result, Term& left, Term& right) result._category = "bool"; +/* std::cout << "# " << left._raw << "/" << left._value << "/" << left._category << " > " << right._raw << "/" << right._value << "/" << right._category << " --> " << result._raw << "/" << result._value << "/" << result._category << "\n"; +*/ } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/commands/CmdShow.cpp b/src/commands/CmdShow.cpp index ffd008881..31ae4b03e 100644 --- a/src/commands/CmdShow.cpp +++ b/src/commands/CmdShow.cpp @@ -57,7 +57,8 @@ int CmdShow::execute (std::string& output) // Obtain the arguments from the description. That way, things like '--' // have already been handled. - if (context.a3.size () > 2) + std::vector words = context.a3.extract_words (); + if (words.size () > 2) throw std::string (STRING_CMD_SHOW_ARGS); int width = context.getWidth (); @@ -264,13 +265,8 @@ int CmdShow::execute (std::string& output) std::string section; // Look for the first plausible argument which could be a pattern - // TODO Replace this 'section' assessment with something that scans the - // arguments and pulls out either or strings to use as - // search items. -/* - if (context.args.size () == 2) - section = context.args[1]; -*/ + if (words.size ()) + section = words[0]; if (section == "all") section = "";