mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Timew: Combined argc/argv into args
- Modified lightweightVersionCheck.
This commit is contained in:
parent
a21206bfb3
commit
ee351d33e3
3 changed files with 9 additions and 4 deletions
|
@ -42,9 +42,9 @@
|
|||
#include <iostream>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool lightweightVersionCheck (int argc, const char** argv)
|
||||
bool lightweightVersionCheck (const std::vector <std::string>& args)
|
||||
{
|
||||
if (argc == 2 && ! std::strcmp (argv[1], "--version"))
|
||||
if (args.size () == 2 && args[1] == "--version")
|
||||
{
|
||||
std::cout << VERSION << "\n";
|
||||
return true;
|
||||
|
|
|
@ -48,9 +48,14 @@ int main (int argc, const char** argv)
|
|||
// buffers the messages until it has a file name to write to.
|
||||
Log log;
|
||||
|
||||
// Make a vector of args, instead of argc/argv.
|
||||
std::vector <std::string> args;
|
||||
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 (argc, argv))
|
||||
if (lightweightVersionCheck (args))
|
||||
return status;
|
||||
|
||||
try
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <Log.h>
|
||||
|
||||
// init.cpp
|
||||
bool lightweightVersionCheck (int, const char**);
|
||||
bool lightweightVersionCheck (const std::vector <std::string>&);
|
||||
void initializeData (Configuration&, Database&, Log&);
|
||||
void initializeRules (Configuration&, Rules&, Log&);
|
||||
void initializeExtensions (Configuration&, Extensions&, Log&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue