mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
- Set up structure for AUTHORS file.
- Set up NEWS file, with pleas for feedback. - Added welcome message to README. - Completed a chunk of the TUTORIAL. - Added error handling for "task export" when a file name is not specified.
This commit is contained in:
parent
04da56193e
commit
b34cb90709
5 changed files with 259 additions and 82 deletions
50
src/task.cpp
50
src/task.cpp
|
@ -2353,34 +2353,38 @@ void handleDone (const TDB& tdb, T& task, Config& conf)
|
|||
void handleExport (const TDB& tdb, T& task, Config& conf)
|
||||
{
|
||||
std::string file = trim (task.getDescription ());
|
||||
|
||||
std::ofstream out (file.c_str ());
|
||||
if (out.good ())
|
||||
if (file.length () > 0)
|
||||
{
|
||||
out << "'id',"
|
||||
<< "'status',"
|
||||
<< "'tags',"
|
||||
<< "'entry',"
|
||||
<< "'start',"
|
||||
<< "'due',"
|
||||
<< "'end',"
|
||||
<< "'project',"
|
||||
<< "'priority',"
|
||||
<< "'fg',"
|
||||
<< "'bg',"
|
||||
<< "'description'"
|
||||
<< "\n";
|
||||
|
||||
std::vector <T> all;
|
||||
tdb.allT (all);
|
||||
foreach (t, all)
|
||||
std::ofstream out (file.c_str ());
|
||||
if (out.good ())
|
||||
{
|
||||
out << t->composeCSV ().c_str ();
|
||||
out << "'id',"
|
||||
<< "'status',"
|
||||
<< "'tags',"
|
||||
<< "'entry',"
|
||||
<< "'start',"
|
||||
<< "'due',"
|
||||
<< "'end',"
|
||||
<< "'project',"
|
||||
<< "'priority',"
|
||||
<< "'fg',"
|
||||
<< "'bg',"
|
||||
<< "'description'"
|
||||
<< "\n";
|
||||
|
||||
std::vector <T> all;
|
||||
tdb.allT (all);
|
||||
foreach (t, all)
|
||||
{
|
||||
out << t->composeCSV ().c_str ();
|
||||
}
|
||||
out.close ();
|
||||
}
|
||||
out.close ();
|
||||
else
|
||||
throw std::string ("Could not write to export file.");
|
||||
}
|
||||
else
|
||||
throw std::string ("Could not write to export file.");
|
||||
throw std::string ("You must specify a file to write to.");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue