mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
init: lightweightVersionCheck no longer requires any arg processing
This commit is contained in:
parent
85c18376e3
commit
370c024409
3 changed files with 8 additions and 8 deletions
|
@ -41,9 +41,9 @@
|
|||
#include <iostream>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool lightweightVersionCheck (const std::vector <std::string>& args)
|
||||
bool lightweightVersionCheck (int argc, const char** argv)
|
||||
{
|
||||
if (args.size () == 2 && args[1] == "--version")
|
||||
if (argc == 2 && std::string (argv[1]) == "--version")
|
||||
{
|
||||
std::cout << VERSION << "\n";
|
||||
return true;
|
||||
|
|
|
@ -38,6 +38,11 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
int main (int argc, const char** argv)
|
||||
{
|
||||
// Lightweight version checking that doesn't require initialization or I/O.
|
||||
int status = 0;
|
||||
if (lightweightVersionCheck (argc, argv))
|
||||
return status;
|
||||
|
||||
// The log is needed early, in order to capture as much as possible, but will
|
||||
// only be given a file name once the rules are loaded. The log therefore
|
||||
// buffers the messages until it has a file name to write to.
|
||||
|
@ -49,11 +54,6 @@ int main (int argc, const char** argv)
|
|||
for (int i = 0; i < argc; i++)
|
||||
args.push_back (argv[i]);
|
||||
|
||||
// Lightweight version checking that doesn't require initialization or I/O.
|
||||
int status = 0;
|
||||
if (lightweightVersionCheck (args))
|
||||
return status;
|
||||
|
||||
try
|
||||
{
|
||||
// Prepare the database, but do not read data.
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include <Color.h>
|
||||
|
||||
// init.cpp
|
||||
bool lightweightVersionCheck (const std::vector <std::string>&);
|
||||
bool lightweightVersionCheck (int, const char**);
|
||||
void initializeDataAndRules (Database&, Rules&, Log&);
|
||||
void initializeExtensions (Rules&, Extensions&, Log&);
|
||||
int dispatchCommand (const std::vector <std::string>&, Database&, Rules&, Extensions&, Log&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue