mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Feature #1124
- 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:
parent
973e0ed56b
commit
92c3f0862d
8 changed files with 49 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -39,5 +39,12 @@ public:
|
|||
int execute (std::string&);
|
||||
};
|
||||
|
||||
class CmdShowRaw : public Command
|
||||
{
|
||||
public:
|
||||
CmdShowRaw ();
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -154,6 +154,7 @@ void Command::factory (std::map <std::string, Command*>& all)
|
|||
c = new CmdReports (); all[c->keyword ()] = c;
|
||||
c = new CmdShell (); all[c->keyword ()] = c;
|
||||
c = new CmdShow (); all[c->keyword ()] = c;
|
||||
c = new CmdShowRaw (); all[c->keyword ()] = c;
|
||||
c = new CmdStart (); all[c->keyword ()] = c;
|
||||
c = new CmdStats (); all[c->keyword ()] = c;
|
||||
c = new CmdStop (); all[c->keyword ()] = c;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue