mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
init: Implemented lightweightVersionCheck
This commit is contained in:
parent
792c0a7b5c
commit
0a29c9d321
3 changed files with 61 additions and 56 deletions
15
src/init.cpp
15
src/init.cpp
|
@ -34,7 +34,20 @@
|
|||
#include <commands.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <iostream> // TODO Remove
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool lightweightVersionCheck (int argc, const char** argv)
|
||||
{
|
||||
if (argc == 2 && ! std::strcmp (argv[1], "--version"))
|
||||
{
|
||||
std::cout << VERSION << "\n";
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void initializeData (Configuration& configuration, Database& database)
|
||||
|
|
|
@ -35,23 +35,17 @@
|
|||
//#include <LR0.h>
|
||||
#include <iostream>
|
||||
#include <new>
|
||||
#include <cstring>
|
||||
|
||||
// No global data.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int main (int argc, const char** argv)
|
||||
{
|
||||
// Lightweight version checking that doesn't require initialization or I/O.
|
||||
int status = 0;
|
||||
bool debug = true;
|
||||
if (lightweightVersionCheck (argc, argv))
|
||||
return status;
|
||||
|
||||
// Lightweight version checking that doesn't require initialization or any I/O.
|
||||
if (argc == 2 && ! strcmp (argv[1], "--version"))
|
||||
{
|
||||
std::cout << VERSION << "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
// Load the configuration, prepare the database, but do not read data.
|
||||
|
@ -68,15 +62,13 @@ int main (int argc, const char** argv)
|
|||
Grammar cliGrammar;
|
||||
cliGrammar.debug (debug);
|
||||
cliGrammar.loadFromFile (cliFile);
|
||||
*/
|
||||
|
||||
// Instantiate the parser.
|
||||
/*
|
||||
LR0 cliParser;
|
||||
cliParser.debug (debug);
|
||||
cliParser.initialize (cliGrammar);
|
||||
*/
|
||||
|
||||
// TODO Parse CLI.
|
||||
*/
|
||||
|
||||
// Load the rules.
|
||||
Rules rules;
|
||||
|
@ -103,7 +95,6 @@ int main (int argc, const char** argv)
|
|||
std::cerr << "Error: Unknown problem, please report.\n";
|
||||
status = -2;
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <Rules.h>
|
||||
|
||||
// init.cpp
|
||||
bool lightweightVersionCheck (int, const char**);
|
||||
void initializeData (Configuration&, Database&);
|
||||
void initializeRules (Configuration&, Rules&);
|
||||
int dispatchCommand (int, const char**, Configuration&, Rules&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue