Export
- Added the ability to include the ID in _query command results.
This commit is contained in:
@@ -426,11 +426,15 @@ std::string Task::composeYAML () const
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string Task::composeJSON () const
|
||||
std::string Task::composeJSON (bool include_id /*= false*/) const
|
||||
{
|
||||
std::stringstream out;
|
||||
out << "{";
|
||||
|
||||
// ID inclusion is optional, not recommended.
|
||||
if (include_id)
|
||||
out << "\"id\":" << id << ",";
|
||||
|
||||
// Used for determining type.
|
||||
Att att;
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
void parse (const std::string&);
|
||||
std::string composeCSV () const;
|
||||
std::string composeYAML () const;
|
||||
std::string composeJSON () const;
|
||||
std::string composeJSON (bool include_id = false) const;
|
||||
|
||||
// Status values.
|
||||
enum status {pending, completed, deleted, recurring, waiting};
|
||||
|
||||
@@ -613,7 +613,7 @@ int handleQuery (std::string& outs)
|
||||
if (t != tasks.begin ())
|
||||
outs += ",\n";
|
||||
|
||||
outs += t->composeJSON ();
|
||||
outs += t->composeJSON (true);
|
||||
}
|
||||
|
||||
outs += "\n";
|
||||
|
||||
Reference in New Issue
Block a user