mirror of
https://github.com/GothenburgBitFactory/taskshell.git
synced 2025-06-26 10:54:29 +02:00
Shell: Integrated stubbed command
This commit is contained in:
parent
2d40187fee
commit
ef7a3c97de
2 changed files with 21 additions and 0 deletions
|
@ -34,6 +34,7 @@
|
||||||
int cmdHelp (const std::vector <std::string>& args)
|
int cmdHelp (const std::vector <std::string>& args)
|
||||||
{
|
{
|
||||||
std::cout << "Run 'man tasksh' for help.\n";
|
std::cout << "Run 'man tasksh' for help.\n";
|
||||||
|
std::cout << "Run '! man tasksh' from inside tasksh.\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
20
src/main.cpp
20
src/main.cpp
|
@ -46,9 +46,26 @@
|
||||||
int cmdHelp (const std::vector <std::string>&);
|
int cmdHelp (const std::vector <std::string>&);
|
||||||
int cmdDiagnostics (const std::vector <std::string>&);
|
int cmdDiagnostics (const std::vector <std::string>&);
|
||||||
int cmdReview (const std::vector <std::string>&);
|
int cmdReview (const std::vector <std::string>&);
|
||||||
|
int cmdShell (const std::vector <std::string>&);
|
||||||
std::string promptCompose ();
|
std::string promptCompose ();
|
||||||
std::string findTaskwarrior ();
|
std::string findTaskwarrior ();
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
static void welcome ()
|
||||||
|
{
|
||||||
|
std::cout << PACKAGE_STRING
|
||||||
|
<< "\n"
|
||||||
|
<< "\n"
|
||||||
|
<< " Commands:\n"
|
||||||
|
<< " tasksh> review # Task review session\n"
|
||||||
|
<< " tasksh> list # Any Taskwarrior command\n"
|
||||||
|
<< " tasksh> diagnostics # Tasksh diagnostics\n"
|
||||||
|
<< " tasksh> help # Tasksh help\n"
|
||||||
|
<< " tasksh> !ls -al # Any shell command. May also use 'exec'\n"
|
||||||
|
<< " tasksh> quit # End of session. May also use 'exit'\n"
|
||||||
|
<< "\n";
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
const std::string getResponse (const std::string& prompt)
|
const std::string getResponse (const std::string& prompt)
|
||||||
{
|
{
|
||||||
|
@ -103,6 +120,8 @@ static int commandLoop ()
|
||||||
else if (closeEnough ("help", args[0], 3)) status = cmdHelp (args);
|
else if (closeEnough ("help", args[0], 3)) status = cmdHelp (args);
|
||||||
else if (closeEnough ("diagnostics", args[0], 3)) status = cmdDiagnostics (args);
|
else if (closeEnough ("diagnostics", args[0], 3)) status = cmdDiagnostics (args);
|
||||||
else if (closeEnough ("review", args[0], 3)) status = cmdReview (args);
|
else if (closeEnough ("review", args[0], 3)) status = cmdReview (args);
|
||||||
|
else if (closeEnough ("exec", args[0], 3) ||
|
||||||
|
args[0][0] == '!') status = cmdShell (args);
|
||||||
else if (command != "")
|
else if (command != "")
|
||||||
{
|
{
|
||||||
command = "task " + command;
|
command = "task " + command;
|
||||||
|
@ -131,6 +150,7 @@ int main (int argc, const char** argv)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
welcome ();
|
||||||
while ((status = commandLoop ()) == 0)
|
while ((status = commandLoop ()) == 0)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue