diff --git a/ChangeLog b/ChangeLog index d0bb8b228..803ab37ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 ------------------------------ diff --git a/html/task.html b/html/task.html index 8fdd6d773..ce46b4a00 100644 --- a/html/task.html +++ b/html/task.html @@ -117,8 +117,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.

    diff --git a/src/import.cpp b/src/import.cpp index a6ccf26c8..be3dab21e 100644 --- a/src/import.cpp +++ b/src/import.cpp @@ -28,34 +28,13 @@ #include #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 & 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 & 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 & 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 & 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 << "?";