MCPcopy Create free account
hub / github.com/GothenburgBitFactory/taskwarrior / execute

Method execute

src/commands/CmdImportV2.cpp:58–82  ·  view source on GitHub ↗

///////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

56
57////////////////////////////////////////////////////////////////////////////////
58int CmdImportV2::execute(std::string&) {
59 std::vector<std::map<std::string, std::string>> task_data;
60
61 std::string location = (Context::getContext().data_dir);
62 File pending_file = File(location + "/pending.data");
63 if (pending_file.exists()) {
64 TF2 pending_tf;
65 pending_tf.target(pending_file);
66 auto& pending_tasks = pending_tf.get_tasks();
67 task_data.insert(task_data.end(), pending_tasks.begin(), pending_tasks.end());
68 }
69 File completed_file = File(location + "/completed.data");
70 if (completed_file.exists()) {
71 TF2 completed_tf;
72 completed_tf.target(completed_file);
73 auto& completed_tasks = completed_tf.get_tasks();
74 task_data.insert(task_data.end(), completed_tasks.begin(), completed_tasks.end());
75 }
76
77 auto count = import(task_data);
78
79 Context::getContext().footnote(
80 format("Imported {1} tasks from `*.data` files. You may now delete these files.", count));
81 return 0;
82}
83
84////////////////////////////////////////////////////////////////////////////////
85int CmdImportV2::import(const std::vector<std::map<std::string, std::string>>& task_data) {

Callers

nothing calls this directly

Calls 4

existsMethod · 0.80
targetMethod · 0.80
get_tasksMethod · 0.80
footnoteMethod · 0.80

Tested by

no test coverage detected