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>
////////////////////////////////////////////////////////////////////////////////
void CmdClear ()
int CmdClear ()
{
std::cout << "# clear\n";
return 0;
}
////////////////////////////////////////////////////////////////////////////////

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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