mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
init: initializeDataAndRules no longer logs
This commit is contained in:
parent
d4bb341ee3
commit
055d76f5fd
3 changed files with 4 additions and 23 deletions
23
src/init.cpp
23
src/init.cpp
|
@ -85,8 +85,7 @@ void initializeEntities (CLI& cli)
|
||||||
void initializeDataAndRules (
|
void initializeDataAndRules (
|
||||||
CLI& cli,
|
CLI& cli,
|
||||||
Database& database,
|
Database& database,
|
||||||
Rules& rules,
|
Rules& rules)
|
||||||
Log& log)
|
|
||||||
{
|
{
|
||||||
// Make common hints available via rules:
|
// Make common hints available via rules:
|
||||||
// :debug --> debug
|
// :debug --> debug
|
||||||
|
@ -102,23 +101,12 @@ void initializeDataAndRules (
|
||||||
|
|
||||||
if (rules.getBoolean ("debug"))
|
if (rules.getBoolean ("debug"))
|
||||||
std::cout << cli.dump () << "\n";
|
std::cout << cli.dump () << "\n";
|
||||||
else
|
|
||||||
log.ignore ("debug");
|
|
||||||
|
|
||||||
// The $TIMEWARRIORDB environment variable overrides the default value of
|
// The $TIMEWARRIORDB environment variable overrides the default value of
|
||||||
// ~/.timewarrior‥
|
// ~/.timewarrior‥
|
||||||
Directory dbLocation;
|
Directory dbLocation;
|
||||||
char* override = getenv ("TIMEWARRIORDB");
|
char* override = getenv ("TIMEWARRIORDB");
|
||||||
if (override)
|
dbLocation = Directory (override ? override : "~/.timewarrior");
|
||||||
{
|
|
||||||
log.write ("debug", std::string ("TIMEWARRIORDB ") + override);
|
|
||||||
dbLocation = Directory (override);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dbLocation = Directory ("~/.timewarrior");
|
|
||||||
log.write ("debug", std::string ("Using default DB location ") + dbLocation._data);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If dbLocation does not exist, ask whether it should be created.
|
// If dbLocation does not exist, ask whether it should be created.
|
||||||
bool shinyNewDatabase = false;
|
bool shinyNewDatabase = false;
|
||||||
|
@ -126,7 +114,6 @@ void initializeDataAndRules (
|
||||||
confirm ("Create new database in " + dbLocation._data + "?"))
|
confirm ("Create new database in " + dbLocation._data + "?"))
|
||||||
{
|
{
|
||||||
dbLocation.create (0700);
|
dbLocation.create (0700);
|
||||||
log.write ("debug", std::string ("Created missing database in ") + dbLocation._data);
|
|
||||||
shinyNewDatabase = true;
|
shinyNewDatabase = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +150,6 @@ void initializeDataAndRules (
|
||||||
// located the config file, the 'db' location is already known. This is just
|
// located the config file, the 'db' location is already known. This is just
|
||||||
// for subsequent internal use.
|
// for subsequent internal use.
|
||||||
rules.set ("temp.db", dbLocation._data);
|
rules.set ("temp.db", dbLocation._data);
|
||||||
log.write ("debug", std::string (" rc.db=") + rules.get ("temp.db"));
|
|
||||||
|
|
||||||
// Perhaps some subsequent code would like to know this is a new db and
|
// Perhaps some subsequent code would like to know this is a new db and
|
||||||
// possibly a first run.
|
// possibly a first run.
|
||||||
|
@ -171,11 +157,6 @@ void initializeDataAndRules (
|
||||||
|
|
||||||
// Initialize the database (no data read), but files are enumerated.
|
// Initialize the database (no data read), but files are enumerated.
|
||||||
database.initialize (data._data);
|
database.initialize (data._data);
|
||||||
log.write ("debug", database.dump ());
|
|
||||||
|
|
||||||
// TODO Give the log file a temp fake name. To be removed.
|
|
||||||
log.file (dbLocation._data + "/timewarrior.log");
|
|
||||||
log.write ("debug", rules.dump ());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -77,7 +77,7 @@ int main (int argc, const char** argv)
|
||||||
// Prepare the database, but do not read data.
|
// Prepare the database, but do not read data.
|
||||||
Database database;
|
Database database;
|
||||||
Rules rules;
|
Rules rules;
|
||||||
initializeDataAndRules (cli, database, rules, log);
|
initializeDataAndRules (cli, database, rules);
|
||||||
|
|
||||||
// Load extension script info.
|
// Load extension script info.
|
||||||
Extensions extensions;
|
Extensions extensions;
|
||||||
|
|
|
@ -38,9 +38,9 @@
|
||||||
// init.cpp
|
// init.cpp
|
||||||
bool lightweightVersionCheck (int, const char**);
|
bool lightweightVersionCheck (int, const char**);
|
||||||
void initializeEntities (CLI&);
|
void initializeEntities (CLI&);
|
||||||
void initializeDataAndRules (CLI&, Database&, Rules&, Log&);
|
|
||||||
void initializeExtensions (Rules&, Extensions&, Log&);
|
void initializeExtensions (Rules&, Extensions&, Log&);
|
||||||
int dispatchCommand (CLI&, Database&, Rules&, Extensions&, Log&);
|
int dispatchCommand (CLI&, Database&, Rules&, Extensions&, Log&);
|
||||||
|
void initializeDataAndRules (CLI&, Database&, Rules&);
|
||||||
|
|
||||||
// helper.cpp
|
// helper.cpp
|
||||||
Color tagColor (const Rules&, const std::string&);
|
Color tagColor (const Rules&, const std::string&);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue