mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Enhancement - export.yaml
- Preliminary export.yaml support. No unit tests yet, and no decision on including this feature. It may be that libyaml is the right choice, as an optional dependency.
This commit is contained in:
parent
8b02d2bdeb
commit
2b48ae8e38
6 changed files with 67 additions and 10 deletions
29
src/Task.cpp
29
src/Task.cpp
|
@ -1,7 +1,7 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// task - a command line task list manager.
|
||||
//
|
||||
// Copyright 2006 - 2010, Paul Beckingham.
|
||||
// Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
// All rights reserved.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it under
|
||||
|
@ -392,6 +392,33 @@ std::string Task::composeCSV () const
|
|||
return out.str ();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string Task::composeYAML () const
|
||||
{
|
||||
std::stringstream out;
|
||||
|
||||
// Task header.
|
||||
out << " task:\n";
|
||||
|
||||
// Get all the supported attribute names.
|
||||
std::vector <std::string> names;
|
||||
Att::allNames (names);
|
||||
std::sort (names.begin (), names.end ());
|
||||
|
||||
foreach (name, names)
|
||||
out << " " << *name << ": " << get (*name) << "\n";
|
||||
|
||||
// Now the annotations, which are not listed by the Att::allNames call.
|
||||
std::vector <Att> annotations;
|
||||
getAnnotations (annotations);
|
||||
foreach (a, annotations)
|
||||
out << " annotation:\n"
|
||||
<< " entry: " << a->name().substr (12) << "\n"
|
||||
<< " description: " << a->value () << "\n";
|
||||
|
||||
return out.str ();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Task::getAnnotations (std::vector <Att>& annotations) const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue