mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
File Import
- Updated documentation. - Added another recognized format - task command line.
This commit is contained in:
parent
99dc72f26f
commit
e4f5d6579c
3 changed files with 29 additions and 32 deletions
|
@ -20,8 +20,10 @@
|
|||
frequency, a due date, and an optional until date.
|
||||
+ When a recurring task is modified, all other instances of the recurring
|
||||
task are also modified.
|
||||
+ Task can now import tasks from a variety of data formats. See online
|
||||
docs for full details.
|
||||
+ Task can now import tasks from a variety of data formats, including task
|
||||
export files from versions 1.4.3 and earlier, versions 1.5.0 and later,
|
||||
todo.sh 2.x, CSV, plain text and task command line. See online docs for
|
||||
full details.
|
||||
|
||||
------ old releases ------------------------------
|
||||
|
||||
|
|
|
@ -117,8 +117,10 @@
|
|||
frequency, a due date, and an optional until date.
|
||||
<li>When a recurring task is modified, all other instances of the recurring
|
||||
task are also modified.
|
||||
<li>Task can now import tasks from a variety of data formats. See online
|
||||
docs for full details.
|
||||
<li>Task can now import tasks from a variety of data formats, including task
|
||||
export files from versions 1.4.3 and earlier, versions 1.5.0 and later,
|
||||
todo.sh 2.x, CSV, plain text and task command line. See online docs for
|
||||
full details.
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
|
|
|
@ -28,34 +28,13 @@
|
|||
#include <sstream>
|
||||
#include "task.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// todo.sh v2.x
|
||||
// file format: (A) Walk the dog +project @context
|
||||
// x 2009-03-25 Walk the dog +project @context
|
||||
// priority: (A) - (Z)
|
||||
// multiple projects: +project
|
||||
// multiple contexts: @context
|
||||
|
||||
// task >= 1.5 export
|
||||
// file format: id,uuid,status,tags,entry,start,due,recur,end,project,
|
||||
// priority,fg,bg,description\n
|
||||
|
||||
// task < 1.5 export
|
||||
// file format: id,uuid,status,tags,entry,start,due,project,priority,
|
||||
// fg,bg,description\n
|
||||
|
||||
// single line text
|
||||
// file format: foo bar baz
|
||||
|
||||
// CSV
|
||||
// file format: project,priority,description
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
enum fileType
|
||||
{
|
||||
not_a_clue,
|
||||
task_1_4_3,
|
||||
task_1_5_0,
|
||||
task_cmd_line,
|
||||
todo_sh_2_0,
|
||||
csv,
|
||||
text
|
||||
|
@ -85,6 +64,8 @@ static fileType determineFileType (const std::vector <std::string>& lines)
|
|||
return task_1_4_3;
|
||||
}
|
||||
|
||||
// TODO task_cmd_line
|
||||
|
||||
// x 2009-03-25 Walk the dog +project @context
|
||||
// This is a test +project @context
|
||||
for (unsigned int i = 0; i < lines.size (); ++i)
|
||||
|
@ -125,7 +106,7 @@ static fileType determineFileType (const std::vector <std::string>& lines)
|
|||
}
|
||||
}
|
||||
|
||||
// CSV - commas on every line.
|
||||
// CSV - commas on every non-comment, non-trivial line.
|
||||
bool commas_on_every_line = true;
|
||||
for (unsigned int i = 0; i < lines.size (); ++i)
|
||||
{
|
||||
|
@ -177,6 +158,15 @@ static std::string importTask_1_5_0 (
|
|||
return "task 1.5.0\n";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
static std::string importTaskCmdLine (
|
||||
TDB& tdb,
|
||||
Config& conf,
|
||||
const std::vector <std::string>& lines)
|
||||
{
|
||||
return "task command line\n";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
static std::string importTodoSh_2_0 (
|
||||
TDB& tdb,
|
||||
|
@ -232,6 +222,8 @@ static std::string importCSV (
|
|||
Config& conf,
|
||||
const std::vector <std::string>& lines)
|
||||
{
|
||||
// TODO Allow any number of fields, but attempt to map into task fields.
|
||||
// TODO Must have header line to name fields.
|
||||
return "CSV\n";
|
||||
}
|
||||
|
||||
|
@ -251,11 +243,12 @@ std::string handleImport (TDB& tdb, T& task, Config& conf)
|
|||
// Determine which type it might be, then attempt an import.
|
||||
switch (determineFileType (lines))
|
||||
{
|
||||
case task_1_4_3: out << importTask_1_4_3 (tdb, conf, lines); break;
|
||||
case task_1_5_0: out << importTask_1_5_0 (tdb, conf, lines); break;
|
||||
case todo_sh_2_0: out << importTodoSh_2_0 (tdb, conf, lines); break;
|
||||
case csv: out << importCSV (tdb, conf, lines); break;
|
||||
case text: out << importText (tdb, conf, lines); break;
|
||||
case task_1_4_3: out << importTask_1_4_3 (tdb, conf, lines); break;
|
||||
case task_1_5_0: out << importTask_1_5_0 (tdb, conf, lines); break;
|
||||
case task_cmd_line: out << importTaskCmdLine (tdb, conf, lines); break;
|
||||
case todo_sh_2_0: out << importTodoSh_2_0 (tdb, conf, lines); break;
|
||||
case csv: out << importCSV (tdb, conf, lines); break;
|
||||
case text: out << importText (tdb, conf, lines); break;
|
||||
|
||||
case not_a_clue:
|
||||
out << "?";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue