Command - show

- Fixed the show command to accept 'all' or a substring to search for
  in the configuration file.
This commit is contained in:
Paul Beckingham 2011-08-01 01:18:12 -04:00
parent 9275f3460f
commit 76760fe434
2 changed files with 12 additions and 8 deletions

View file

@ -297,12 +297,14 @@ void E9::operator_lt (Term& result, Term& left, Term& right)
result._category = "bool"; result._category = "bool";
/*
std::cout << "# " << left._raw << "/" << left._value << "/" << left._category std::cout << "# " << left._raw << "/" << left._value << "/" << left._category
<< " < " << " < "
<< right._raw << "/" << right._value << "/" << right._category << right._raw << "/" << right._value << "/" << right._category
<< " --> " << " --> "
<< result._raw << "/" << result._value << "/" << result._category << result._raw << "/" << result._value << "/" << result._category
<< "\n"; << "\n";
*/
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -326,12 +328,14 @@ void E9::operator_lte (Term& result, Term& left, Term& right)
result._category = "bool"; result._category = "bool";
/*
std::cout << "# " << left._raw << "/" << left._value << "/" << left._category std::cout << "# " << left._raw << "/" << left._value << "/" << left._category
<< " <= " << " <= "
<< right._raw << "/" << right._value << "/" << right._category << right._raw << "/" << right._value << "/" << right._category
<< " --> " << " --> "
<< result._raw << "/" << result._value << "/" << result._category << result._raw << "/" << result._value << "/" << result._category
<< "\n"; << "\n";
*/
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -355,12 +359,14 @@ void E9::operator_gte (Term& result, Term& left, Term& right)
result._category = "bool"; result._category = "bool";
/*
std::cout << "# " << left._raw << "/" << left._value << "/" << left._category std::cout << "# " << left._raw << "/" << left._value << "/" << left._category
<< " >= " << " >= "
<< right._raw << "/" << right._value << "/" << right._category << right._raw << "/" << right._value << "/" << right._category
<< " --> " << " --> "
<< result._raw << "/" << result._value << "/" << result._category << result._raw << "/" << result._value << "/" << result._category
<< "\n"; << "\n";
*/
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -383,12 +389,14 @@ void E9::operator_gt (Term& result, Term& left, Term& right)
result._category = "bool"; result._category = "bool";
/*
std::cout << "# " << left._raw << "/" << left._value << "/" << left._category std::cout << "# " << left._raw << "/" << left._value << "/" << left._category
<< " > " << " > "
<< right._raw << "/" << right._value << "/" << right._category << right._raw << "/" << right._value << "/" << right._category
<< " --> " << " --> "
<< result._raw << "/" << result._value << "/" << result._category << result._raw << "/" << result._value << "/" << result._category
<< "\n"; << "\n";
*/
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -57,7 +57,8 @@ int CmdShow::execute (std::string& output)
// Obtain the arguments from the description. That way, things like '--' // Obtain the arguments from the description. That way, things like '--'
// have already been handled. // have already been handled.
if (context.a3.size () > 2) std::vector <std::string> words = context.a3.extract_words ();
if (words.size () > 2)
throw std::string (STRING_CMD_SHOW_ARGS); throw std::string (STRING_CMD_SHOW_ARGS);
int width = context.getWidth (); int width = context.getWidth ();
@ -264,13 +265,8 @@ int CmdShow::execute (std::string& output)
std::string section; std::string section;
// Look for the first plausible argument which could be a pattern // Look for the first plausible argument which could be a pattern
// TODO Replace this 'section' assessment with something that scans the if (words.size ())
// arguments and pulls out either <word> or <pattern> strings to use as section = words[0];
// search items.
/*
if (context.args.size () == 2)
section = context.args[1];
*/
if (section == "all") if (section == "all")
section = ""; section = "";