- When a command encountered is not supported directly by tasksh, simply send
  it to Taskwarrior.
This commit is contained in:
Paul Beckingham 2014-06-21 08:06:04 -04:00
parent bba1bbcaaa
commit 70454c35b9
3 changed files with 14 additions and 2 deletions

View file

@ -38,7 +38,7 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
int cmdDiagnostics () int cmdDiagnostics ()
{ {
std::cout << "diagnostics\n"; std::cout << "tasksh diagnostics\n";
// TODO Version // TODO Version
// TODO Platform // TODO Platform

View file

@ -33,7 +33,7 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
int cmdHelp () int cmdHelp ()
{ {
std::cout << "help\n"; std::cout << "tasksh help\n";
return 0; return 0;
} }

View file

@ -26,7 +26,9 @@
#include <cmake.h> #include <cmake.h>
#include <iostream> #include <iostream>
#include <string>
#include <cstring> #include <cstring>
#include <stdlib.h>
#include <i18n.h> #include <i18n.h>
#include <text.h> #include <text.h>
@ -43,6 +45,7 @@
int cmdHelp (); int cmdHelp ();
int cmdDiagnostics (); int cmdDiagnostics ();
std::string composePrompt (); std::string composePrompt ();
std::string findTaskwarrior ();
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
static int commandLoop () static int commandLoop ()
@ -81,6 +84,15 @@ static int commandLoop ()
else if (closeEnough ("quit", command, 3)) status = 1; else if (closeEnough ("quit", command, 3)) status = 1;
else if (closeEnough ("help", command, 3)) status = cmdHelp (); else if (closeEnough ("help", command, 3)) status = cmdHelp ();
else if (closeEnough ("diagnostics", command, 3)) status = cmdDiagnostics (); else if (closeEnough ("diagnostics", command, 3)) status = cmdDiagnostics ();
else
{
std::cout << "[task " << command << "]\n";
command = "task " + command;
system (command.c_str ());
// Deliberately ignoreѕ taskwarrior exit status, otherwise empty filters
// cause the shell to terminate.
}
return status; return status;
} }