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

Method execute

src/commands/CmdContext.cpp:61–88  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

59
60////////////////////////////////////////////////////////////////////////////////
61int CmdContext::execute(std::string& output) {
62 std::stringstream out;
63
64 // Get the non-attribute, non-fancy command line arguments.
65 auto words = Context::getContext().cli2.getWords();
66 if (words.size() > 0) {
67 auto subcommand = words[0];
68
69 if (subcommand == "define")
70 defineContext(words, out);
71 else if (subcommand == "delete")
72 deleteContext(words, out);
73 else if (subcommand == "list")
74 listContexts(out);
75 else if (subcommand == "none")
76 unsetContext(out);
77 else if (subcommand == "show")
78 showContext(out);
79 else if (words.size())
80 setContext(words, out);
81 } else {
82 listContexts(out);
83 out << "Use 'task context none' to unset the current context.\n";
84 }
85
86 output = out.str();
87 return 0;
88}
89
90////////////////////////////////////////////////////////////////////////////////
91// Joins all the words in the specified interval <from, to) to one string,

Callers

nothing calls this directly

Calls 1

getWordsMethod · 0.80

Tested by

no test coverage detected