mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Enhancements - export
- Implemented Task::composeCSV. - Implemented export command, but removed filename support. This needs to be documented.
This commit is contained in:
parent
efe0b86708
commit
f470acadaa
4 changed files with 69 additions and 51 deletions
32
src/Task.cpp
32
src/Task.cpp
|
@ -298,8 +298,36 @@ void Task::legacyParse (const std::string& line)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string Task::composeCSV ()
|
||||
{
|
||||
throw std::string ("unimplemented Task::composeCSV");
|
||||
return "";
|
||||
std::stringstream out;
|
||||
|
||||
out << "'" << id << "',";
|
||||
out << "'" << get ("uuid") << "',";
|
||||
out << "'" << get ("status") << "',";
|
||||
|
||||
// Tags
|
||||
std::vector <std::string> tags;
|
||||
getTags (tags);
|
||||
std::string allTags;
|
||||
join (allTags, " ", tags);
|
||||
out << "'" << allTags << "',";
|
||||
|
||||
out << "'" << get ("entry") << "',";
|
||||
out << "'" << get ("start") << "',";
|
||||
out << "'" << get ("due") << "',";
|
||||
out << "'" << get ("recur") << "',";
|
||||
out << "'" << get ("end") << "',";
|
||||
out << "'" << get ("project") << "',";
|
||||
out << "'" << get ("priority") << "',";
|
||||
out << "'" << get ("fg") << "',";
|
||||
out << "'" << get ("bg") << "',";
|
||||
|
||||
// Convert single quotes to double quotes, because single quotes are used to
|
||||
// delimit the values that need it.
|
||||
std::string clean = get ("description");
|
||||
std::replace (clean.begin (), clean.end (), '\'', '"');
|
||||
out << "'" << clean << "'\n";
|
||||
|
||||
return out.str ();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue