Dispatch: All commands now return the exit status

This commit is contained in:
Paul Beckingham 2016-03-01 01:16:29 -05:00
parent 2fbe57fdd0
commit b0911ca240
13 changed files with 43 additions and 32 deletions

View file

@ -28,9 +28,10 @@
#include <iostream> #include <iostream>
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void CmdClear () int CmdClear ()
{ {
std::cout << "# clear\n"; std::cout << "# clear\n";
return 0;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -28,11 +28,12 @@
#include <iostream> #include <iostream>
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void CmdDefault () int CmdDefault ()
{ {
// TODO Query database for currently active interval, obtain a summary and // TODO Query database for currently active interval, obtain a summary and
// display the results. // display the results.
std::cout << "# default\n"; std::cout << "# default\n";
return 0;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -28,9 +28,10 @@
#include <iostream> #include <iostream>
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void CmdDefine () int CmdDefine ()
{ {
std::cout << "# define\n"; std::cout << "# define\n";
return 0;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -28,9 +28,10 @@
#include <iostream> #include <iostream>
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void CmdExport () int CmdExport ()
{ {
std::cout << "# export\n"; std::cout << "# export\n";
return 0;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -28,9 +28,10 @@
#include <iostream> #include <iostream>
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void CmdExtension () int CmdExtension ()
{ {
std::cout << "# extension\n"; std::cout << "# extension\n";
return 0;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -28,9 +28,10 @@
#include <iostream> #include <iostream>
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void CmdHelp () int CmdHelp ()
{ {
std::cout << "# help\n"; std::cout << "# help\n";
return 0;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -28,9 +28,10 @@
#include <iostream> #include <iostream>
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void CmdImport () int CmdImport ()
{ {
std::cout << "# import\n"; std::cout << "# import\n";
return 0;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -28,9 +28,10 @@
#include <iostream> #include <iostream>
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void CmdReport () int CmdReport ()
{ {
std::cout << "# report\n"; std::cout << "# report\n";
return 0;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -28,9 +28,10 @@
#include <iostream> #include <iostream>
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void CmdStart () int CmdStart ()
{ {
std::cout << "# start\n"; std::cout << "# start\n";
return 0;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -28,9 +28,10 @@
#include <iostream> #include <iostream>
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void CmdStop () int CmdStop ()
{ {
std::cout << "# stop\n"; std::cout << "# stop\n";
return 0;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -28,9 +28,10 @@
#include <iostream> #include <iostream>
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void CmdTrack () int CmdTrack ()
{ {
std::cout << "# track\n"; std::cout << "# track\n";
return 0;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -27,17 +27,17 @@
#ifndef INCLUDED_COMMANDS #ifndef INCLUDED_COMMANDS
#define INCLUDED_COMMANDS #define INCLUDED_COMMANDS
void CmdClear (); int CmdClear ();
void CmdDefault (); int CmdDefault ();
void CmdDefine (); int CmdDefine ();
void CmdExport (); int CmdExport ();
void CmdExtension (); int CmdExtension ();
void CmdHelp (); int CmdHelp ();
void CmdImport (); int CmdImport ();
void CmdReport (); int CmdReport ();
void CmdStart (); int CmdStart ();
void CmdStop (); int CmdStop ();
void CmdTrack (); int CmdTrack ();
#endif #endif

View file

@ -89,19 +89,19 @@ int main (int argc, const char** argv)
// TODO Dispatch to commands. // TODO Dispatch to commands.
if (argc > 1) if (argc > 1)
{ {
if (closeEnough ("help", argv[1], 2)) CmdHelp (); if (closeEnough ("help", argv[1], 2)) status = CmdHelp ();
else if (closeEnough ("clear", argv[1], 2)) CmdClear (); else if (closeEnough ("clear", argv[1], 2)) status = CmdClear ();
else if (closeEnough ("define", argv[1], 2)) CmdDefine (); else if (closeEnough ("define", argv[1], 2)) status = CmdDefine ();
else if (closeEnough ("export", argv[1], 2)) CmdExport (); else if (closeEnough ("export", argv[1], 2)) status = CmdExport ();
else if (closeEnough ("import", argv[1], 2)) CmdImport (); else if (closeEnough ("import", argv[1], 2)) status = CmdImport ();
else if (closeEnough ("report", argv[1], 2)) CmdReport (); else if (closeEnough ("report", argv[1], 2)) status = CmdReport ();
else if (closeEnough ("start", argv[1], 2)) CmdStart (); else if (closeEnough ("start", argv[1], 2)) status = CmdStart ();
else if (closeEnough ("stop", argv[1], 2)) CmdStop (); else if (closeEnough ("stop", argv[1], 2)) status = CmdStop ();
else if (closeEnough ("track", argv[1], 2)) CmdTrack (); else if (closeEnough ("track", argv[1], 2)) status = CmdTrack ();
} }
else if (argc == 1) else if (argc == 1)
{ {
CmdDefault (); status = CmdDefault ();
} }
} }