mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Make warning about new tags adhere to :quiet hint
This commit is contained in:
parent
7771d94dee
commit
4f5eb6eb0c
18 changed files with 49 additions and 49 deletions
|
@ -102,13 +102,13 @@ std::vector <std::string> Database::allLines ()
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Database::addInterval (const Interval& interval)
|
||||
void Database::addInterval (const Interval& interval, bool verbose)
|
||||
{
|
||||
auto tags = interval.tags ();
|
||||
|
||||
for (auto& tag : tags)
|
||||
{
|
||||
if (_tagInfoDatabase.incrementTag (tag) == -1)
|
||||
if (_tagInfoDatabase.incrementTag (tag) == -1 && verbose)
|
||||
{
|
||||
std::cout << "Note: '" << quoteIfNeeded (tag) << "' is a new tag." << std::endl;
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ void Database::deleteInterval (const Interval& interval)
|
|||
// Datafile, then add it back to the right Datafile. This is because
|
||||
// modification may involve changing the start date, which could mean the
|
||||
// Interval belongs in a different file.
|
||||
void Database::modifyInterval (const Interval& from, const Interval& to)
|
||||
void Database::modifyInterval (const Interval& from, const Interval& to, bool verbose)
|
||||
{
|
||||
if (!from.empty ())
|
||||
{
|
||||
|
@ -187,7 +187,7 @@ void Database::modifyInterval (const Interval& from, const Interval& to)
|
|||
|
||||
if (!to.empty ())
|
||||
{
|
||||
addInterval (to);
|
||||
addInterval (to, verbose);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright 2015 - 2016, Paul Beckingham, Federico Hernandez.
|
||||
// Copyright 2015 - 2016, Thomas Lauf, Paul Beckingham, Federico Hernandez.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -46,9 +46,9 @@ public:
|
|||
std::string lastLine ();
|
||||
std::vector <std::string> allLines ();
|
||||
|
||||
void addInterval (const Interval&);
|
||||
void addInterval (const Interval&, bool verbose);
|
||||
void deleteInterval (const Interval&);
|
||||
void modifyInterval (const Interval&, const Interval&);
|
||||
void modifyInterval (const Interval&, const Interval &, bool verbose);
|
||||
|
||||
void startTransaction ();
|
||||
void endTransaction ();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright 2015 - 2018, Paul Beckingham, Federico Hernandez.
|
||||
// Copyright 2015 - 2018, Thomas Lauf, Paul Beckingham, Federico Hernandez.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -98,7 +98,7 @@ int CmdContinue (
|
|||
database.deleteInterval (latest);
|
||||
for (auto& interval : flatten (modified, exclusions))
|
||||
{
|
||||
database.addInterval (interval);
|
||||
database.addInterval (interval, rules.getBoolean ("verbose"));
|
||||
|
||||
if (rules.getBoolean ("verbose"))
|
||||
std::cout << '\n' << intervalSummarize (database, rules, interval);
|
||||
|
@ -110,7 +110,7 @@ int CmdContinue (
|
|||
to_copy.range.end = end_time;
|
||||
|
||||
validate (cli, rules, database, to_copy);
|
||||
database.addInterval (to_copy);
|
||||
database.addInterval (to_copy, rules.getBoolean ("verbose"));
|
||||
|
||||
database.endTransaction ();
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright 2015 - 2018, Paul Beckingham, Federico Hernandez.
|
||||
// Copyright 2015 - 2018, Thomas Lauf, Paul Beckingham, Federico Hernandez.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -64,7 +64,7 @@ int CmdDelete (
|
|||
// Update database.
|
||||
database.deleteInterval (latest);
|
||||
for (auto& interval : flatten (modified, exclusions))
|
||||
database.addInterval (interval);
|
||||
database.addInterval (interval, rules.getBoolean ("verbose"));
|
||||
|
||||
dirty = false;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright 2015 - 2018, Paul Beckingham, Federico Hernandez.
|
||||
// Copyright 2015 - 2018, Thomas Lauf, Paul Beckingham, Federico Hernandez.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -62,7 +62,7 @@ int CmdFill (
|
|||
autoFill (rules, database, to);
|
||||
validate (cli, rules, database, to);
|
||||
std::cout << "# to " << to.dump () << "\n";
|
||||
database.addInterval (to);
|
||||
database.addInterval (to, rules.getBoolean ("verbose"));
|
||||
|
||||
// Note: Feedback generated inside autoFill().
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright 2015 - 2018, Paul Beckingham, Federico Hernandez.
|
||||
// Copyright 2015 - 2018, Thomas Lauf, Paul Beckingham, Federico Hernandez.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -77,7 +77,7 @@ int CmdJoin (
|
|||
database.deleteInterval (second);
|
||||
|
||||
validate (cli, rules, database, combined);
|
||||
database.addInterval (combined);
|
||||
database.addInterval (combined, rules.getBoolean ("verbose"));
|
||||
|
||||
database.endTransaction ();
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright 2015 - 2018, Paul Beckingham, Federico Hernandez.
|
||||
// Copyright 2015 - 2018, Thomas Lauf, Paul Beckingham, Federico Hernandez.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -77,7 +77,7 @@ int CmdLengthen (
|
|||
// Update database.
|
||||
database.deleteInterval (latest);
|
||||
for (auto& interval : flatten (modified, exclusions))
|
||||
database.addInterval (interval);
|
||||
database.addInterval (interval, rules.getBoolean ("verbose"));
|
||||
|
||||
dirty = false;
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ int CmdLengthen (
|
|||
Duration dur (delta);
|
||||
i.range.end += dur.toTime_t ();
|
||||
validate (cli, rules, database, i);
|
||||
database.addInterval (i);
|
||||
database.addInterval (i, rules.getBoolean ("verbose"));
|
||||
|
||||
if (rules.getBoolean ("verbose"))
|
||||
std::cout << "Lengthened @" << id << " by " << dur.formatHours () << '\n';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright 2015 - 2018, Paul Beckingham, Federico Hernandez.
|
||||
// Copyright 2015 - 2018, Thomas Lauf, Paul Beckingham, Federico Hernandez.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -80,7 +80,7 @@ int CmdMove (
|
|||
// Update database.
|
||||
database.deleteInterval (latest);
|
||||
for (auto& interval : flatten (modified, exclusions))
|
||||
database.addInterval (interval);
|
||||
database.addInterval (interval, rules.getBoolean ("verbose"));
|
||||
}
|
||||
|
||||
// Move start time.
|
||||
|
@ -107,7 +107,7 @@ int CmdMove (
|
|||
database.deleteInterval (tracked[tracked.size () - id]);
|
||||
|
||||
validate (cli, rules, database, i);
|
||||
database.addInterval (i);
|
||||
database.addInterval (i, rules.getBoolean ("verbose"));
|
||||
|
||||
database.endTransaction ();
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright 2015 - 2018, Paul Beckingham, Federico Hernandez.
|
||||
// Copyright 2015 - 2018, Thomas Lauf, Paul Beckingham, Federico Hernandez.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -73,7 +73,7 @@ int CmdResize (
|
|||
|
||||
i.range.end = i.range.start + dur.toTime_t ();
|
||||
validate (cli, rules, database, i);
|
||||
database.addInterval (i);
|
||||
database.addInterval (i, rules.getBoolean ("verbose"));
|
||||
|
||||
if (rules.getBoolean ("verbose"))
|
||||
std::cout << "Resized @" << id << " to " << dur.formatHours () << '\n';
|
||||
|
|
|
@ -75,7 +75,7 @@ int CmdShorten (
|
|||
// Update database.
|
||||
database.deleteInterval (latest);
|
||||
for (auto& interval : flatten (modified, exclusions))
|
||||
database.addInterval (interval);
|
||||
database.addInterval (interval, rules.getBoolean ("verbose"));
|
||||
|
||||
dirty = false;
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ int CmdShorten (
|
|||
|
||||
i.range.end -= dur.toTime_t ();
|
||||
validate (cli, rules, database, i);
|
||||
database.addInterval (i);
|
||||
database.addInterval (i, rules.getBoolean ("verbose"));
|
||||
|
||||
if (rules.getBoolean ("verbose"))
|
||||
std::cout << "Shortened @" << id << " by " << dur.formatHours () << '\n';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright 2015 - 2018, Paul Beckingham, Federico Hernandez.
|
||||
// Copyright 2015 - 2018, Thomas Lauf, Paul Beckingham, Federico Hernandez.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -77,10 +77,10 @@ int CmdSplit (
|
|||
database.deleteInterval (tracked[tracked.size () - id]);
|
||||
|
||||
validate (cli, rules, database, first);
|
||||
database.addInterval (first);
|
||||
database.addInterval (first, rules.getBoolean ("verbose"));
|
||||
|
||||
validate (cli, rules, database, second);
|
||||
database.addInterval (second);
|
||||
database.addInterval (second, rules.getBoolean ("verbose"));
|
||||
|
||||
if (rules.getBoolean ("verbose"))
|
||||
std::cout << "Split @" << id << '\n';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright 2015 - 2018, Paul Beckingham, Federico Hernandez.
|
||||
// Copyright 2015 - 2018, Thomas Lauf, Paul Beckingham, Federico Hernandez.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -66,7 +66,7 @@ int CmdStart (
|
|||
|
||||
for (auto& interval : flatten (modified, getAllExclusions (rules, modified.range)))
|
||||
{
|
||||
database.addInterval (interval);
|
||||
database.addInterval (interval, rules.getBoolean ("verbose"));
|
||||
|
||||
if (rules.getBoolean ("verbose"))
|
||||
std::cout << intervalSummarize (database, rules, interval);
|
||||
|
@ -85,7 +85,7 @@ int CmdStart (
|
|||
|
||||
// Update database. An open interval does not need to be flattened.
|
||||
validate (cli, rules, database, now);
|
||||
database.addInterval (now);
|
||||
database.addInterval (now, rules.getBoolean ("verbose"));
|
||||
|
||||
if (rules.getBoolean ("verbose"))
|
||||
std::cout << intervalSummarize (database, rules, now);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright 2015 - 2018, Paul Beckingham, Federico Hernandez.
|
||||
// Copyright 2015 - 2018, Thomas Lauf, Paul Beckingham, Federico Hernandez.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -78,7 +78,7 @@ int CmdStop (
|
|||
|
||||
for (auto& interval : flatten (modified, getAllExclusions (rules, modified.range)))
|
||||
{
|
||||
database.addInterval (interval);
|
||||
database.addInterval (interval, rules.getBoolean ("verbose"));
|
||||
|
||||
if (rules.getBoolean ("verbose"))
|
||||
std::cout << intervalSummarize (database, rules, interval);
|
||||
|
@ -103,7 +103,7 @@ int CmdStop (
|
|||
modified.range.start = modified.range.end;
|
||||
modified.range.end = {0};
|
||||
validate (cli, rules, database, modified);
|
||||
database.addInterval (modified);
|
||||
database.addInterval (modified, rules.getBoolean ("verbose"));
|
||||
if (rules.getBoolean ("verbose"))
|
||||
std::cout << '\n' << intervalSummarize (database, rules, modified);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright 2015 - 2018, Paul Beckingham, Federico Hernandez.
|
||||
// Copyright 2015 - 2018, Thomas Lauf, Paul Beckingham, Federico Hernandez.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -70,7 +70,7 @@ int CmdTag (
|
|||
// Update database.
|
||||
database.deleteInterval (latest);
|
||||
for (auto& interval : flatten (modified, exclusions))
|
||||
database.addInterval (interval);
|
||||
database.addInterval (interval, rules.getBoolean ("verbose"));
|
||||
|
||||
dirty = false;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ int CmdTag (
|
|||
i.tag (tag);
|
||||
|
||||
//TODO validate (cli, rules, database, i);
|
||||
database.modifyInterval (tracked[tracked.size () - id], i);
|
||||
database.modifyInterval (tracked[tracked.size () - id], i, rules.getBoolean ("verbose"));
|
||||
|
||||
if (rules.getBoolean ("verbose"))
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright 2015 - 2018, Paul Beckingham, Federico Hernandez.
|
||||
// Copyright 2015 - 2018, Thomas Lauf, Paul Beckingham, Federico Hernandez.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -49,7 +49,7 @@ int CmdTrack (
|
|||
|
||||
for (auto& interval : flatten (filter, getAllExclusions (rules, filter.range)))
|
||||
{
|
||||
database.addInterval (interval);
|
||||
database.addInterval (interval, rules.getBoolean ("verbose"));
|
||||
|
||||
if (rules.getBoolean ("verbose"))
|
||||
std::cout << intervalSummarize (database, rules, interval);
|
||||
|
|
|
@ -34,7 +34,7 @@ static void undoIntervalAction(UndoAction& action, Database& database)
|
|||
Interval before = Interval::fromJson (action.getBefore ());
|
||||
Interval after = Interval::fromJson (action.getAfter ());
|
||||
|
||||
database.modifyInterval (after, before);
|
||||
database.modifyInterval (after, before, false);
|
||||
}
|
||||
|
||||
static void undoConfigAction (UndoAction& action, Rules &rules, Database& database)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright 2015 - 2018, Paul Beckingham, Federico Hernandez.
|
||||
// Copyright 2015 - 2018, Thomas Lauf, Paul Beckingham, Federico Hernandez.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -70,7 +70,7 @@ int CmdUntag (
|
|||
// Update database.
|
||||
database.deleteInterval (latest);
|
||||
for (auto& interval : flatten (modified, exclusions))
|
||||
database.addInterval (interval);
|
||||
database.addInterval (interval, rules.getBoolean ("verbose"));
|
||||
|
||||
dirty = false;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ int CmdUntag (
|
|||
i.untag (tag);
|
||||
|
||||
// TODO validate (cli, rules, database, i);
|
||||
database.modifyInterval (tracked[tracked.size () - id], i);
|
||||
database.modifyInterval (tracked[tracked.size () - id], i, rules.getBoolean ("verbose"));
|
||||
|
||||
if (rules.getBoolean ("verbose"))
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright 2015 - 2016, Paul Beckingham, Federico Hernandez.
|
||||
// Copyright 2015 - 2016, Thomas Lauf, Paul Beckingham, Federico Hernandez.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -120,14 +120,14 @@ static void autoAdjust (
|
|||
// start date of new interval within old interval
|
||||
Interval modified {overlap};
|
||||
modified.range.end = interval.range.start;
|
||||
database.modifyInterval (overlap, modified);
|
||||
database.modifyInterval (overlap, modified, rules.getBoolean ("verbose"));
|
||||
}
|
||||
else if (!start_within_overlap && end_within_overlap)
|
||||
{
|
||||
// end date of new interval within old interval
|
||||
Interval modified {overlap};
|
||||
modified.range.start = interval.range.end;
|
||||
database.modifyInterval (overlap, modified);
|
||||
database.modifyInterval (overlap, modified, rules.getBoolean ("verbose"));
|
||||
}
|
||||
else if (!start_within_overlap && !end_within_overlap)
|
||||
{
|
||||
|
@ -149,12 +149,12 @@ static void autoAdjust (
|
|||
}
|
||||
else
|
||||
{
|
||||
database.modifyInterval (overlap, split1);
|
||||
database.modifyInterval (overlap, split1, rules.getBoolean ("verbose"));
|
||||
}
|
||||
|
||||
if (! split2.range.is_empty ())
|
||||
{
|
||||
database.addInterval (split2);
|
||||
database.addInterval (split2, rules.getBoolean ("verbose"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue