mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
CmdDefine: Rules object propagated to the command
This commit is contained in:
parent
ed34ee0103
commit
3b332eb96c
5 changed files with 12 additions and 7 deletions
|
@ -25,10 +25,11 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <cmake.h>
|
#include <cmake.h>
|
||||||
|
#include <Rules.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
int CmdDefine ()
|
int CmdDefine (Rules& rules)
|
||||||
{
|
{
|
||||||
std::cout << "# define\n";
|
std::cout << "# define\n";
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -27,9 +27,11 @@
|
||||||
#ifndef INCLUDED_COMMANDS
|
#ifndef INCLUDED_COMMANDS
|
||||||
#define INCLUDED_COMMANDS
|
#define INCLUDED_COMMANDS
|
||||||
|
|
||||||
|
#include <Rules.h>
|
||||||
|
|
||||||
int CmdClear ();
|
int CmdClear ();
|
||||||
int CmdDefault ();
|
int CmdDefault ();
|
||||||
int CmdDefine ();
|
int CmdDefine (Rules&);
|
||||||
int CmdExport ();
|
int CmdExport ();
|
||||||
int CmdExtension ();
|
int CmdExtension ();
|
||||||
int CmdHelp ();
|
int CmdHelp ();
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include <iostream> // TODO Remove
|
#include <iostream> // TODO Remove
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
int dispatchCommand (int argc, const char** argv)
|
int dispatchCommand (int argc, const char** argv, Rules& rules)
|
||||||
{
|
{
|
||||||
int status {0};
|
int status {0};
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ int dispatchCommand (int argc, const char** argv)
|
||||||
// command to fn mapping.
|
// command to fn mapping.
|
||||||
if (closeEnough (allCommands[0], argv[1], 2)) status = CmdHelp ();
|
if (closeEnough (allCommands[0], argv[1], 2)) status = CmdHelp ();
|
||||||
else if (closeEnough (allCommands[1], argv[1], 2)) status = CmdClear ();
|
else if (closeEnough (allCommands[1], argv[1], 2)) status = CmdClear ();
|
||||||
else if (closeEnough (allCommands[2], argv[1], 2)) status = CmdDefine ();
|
else if (closeEnough (allCommands[2], argv[1], 2)) status = CmdDefine (rules);
|
||||||
else if (closeEnough (allCommands[3], argv[1], 2)) status = CmdExport ();
|
else if (closeEnough (allCommands[3], argv[1], 2)) status = CmdExport ();
|
||||||
else if (closeEnough (allCommands[4], argv[1], 2)) status = CmdImport ();
|
else if (closeEnough (allCommands[4], argv[1], 2)) status = CmdImport ();
|
||||||
else if (closeEnough (allCommands[5], argv[1], 2)) status = CmdReport ();
|
else if (closeEnough (allCommands[5], argv[1], 2)) status = CmdReport ();
|
||||||
|
|
|
@ -89,8 +89,8 @@ int main (int argc, const char** argv)
|
||||||
// TODO Load rules.
|
// TODO Load rules.
|
||||||
// TODO Parse rules.
|
// TODO Parse rules.
|
||||||
|
|
||||||
// TODO Dispatch to commands.
|
// Dispatch to commands.
|
||||||
status = dispatchCommand (argc, argv);
|
status = dispatchCommand (argc, argv, rules);
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (const std::string& error)
|
catch (const std::string& error)
|
||||||
|
|
|
@ -27,8 +27,10 @@
|
||||||
#ifndef INCLUDED_TIMEW
|
#ifndef INCLUDED_TIMEW
|
||||||
#define INCLUDED_TIMEW
|
#define INCLUDED_TIMEW
|
||||||
|
|
||||||
|
#include <Rules.h>
|
||||||
|
|
||||||
// init.cpp
|
// init.cpp
|
||||||
int dispatchCommand (int, const char**);
|
int dispatchCommand (int, const char**, Rules&);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue