- Added '_show' command to generate a machine-readable configuration settings
  list for use by third-party software (thanks to Jake Bell).
This commit is contained in:
Paul Beckingham 2012-11-17 12:45:44 -05:00
parent 973e0ed56b
commit 92c3f0862d
8 changed files with 49 additions and 1 deletions

View file

@ -438,3 +438,33 @@ int CmdShow::execute (std::string& output)
}
////////////////////////////////////////////////////////////////////////////////
CmdShowRaw::CmdShowRaw ()
{
_keyword = "_show";
_usage = "task _show";
_description = STRING_CMD_SHOWRAW;
_read_only = true;
_displays_id = false;
}
////////////////////////////////////////////////////////////////////////////////
int CmdShowRaw::execute (std::string& output)
{
// Get all the settings.
std::vector <std::string> all;
context.config.all (all);
// Sort alphabetically by name.
std::sort (all.begin (), all.end ());
// Display them all.
std::vector <std::string>::iterator i;
std::stringstream out;
for (i = all.begin (); i != all.end (); ++i)
out << *i << '=' << context.config.get (*i) << "\n";
output = out.str ();
return 0;
}
////////////////////////////////////////////////////////////////////////////////