mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-06-26 10:54:28 +02:00
Make display of ids and annotations the default in summary report for new users
Initialize a new 'timewarrior.cfg' file with the respective settings Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
parent
191ad1ec8a
commit
1d3dd8f440
4 changed files with 82 additions and 72 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
- #661 Make display of ids and annotations the default in summary report for new users
|
||||||
- #669 id filtering for charts and reports
|
- #669 id filtering for charts and reports
|
||||||
- #660 Fix man page section numbers and reference formatting
|
- #660 Fix man page section numbers and reference formatting
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,13 @@ void initializeDirs (const CLI& cli, Rules& rules)
|
||||||
|
|
||||||
if (! configFileLocation.exists ())
|
if (! configFileLocation.exists ())
|
||||||
{
|
{
|
||||||
File (configFileLocation).create (0600);
|
File configFile (configFileLocation);
|
||||||
|
configFile.create (0600);
|
||||||
|
std::vector<std::string> defaultConfig = {
|
||||||
|
"reports.summary.ids = yes\n",
|
||||||
|
"reports.summary.annotations = yes\n",
|
||||||
|
};
|
||||||
|
configFile.append(defaultConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the configuration data.
|
// Load the configuration data.
|
||||||
|
|
|
@ -58,7 +58,7 @@ class TestSummary(TestCase):
|
||||||
code, out, err = self.t("summary :ids {:%Y-%m-%d} - {:%Y-%m-%d}".format(yesterday, tomorrow))
|
code, out, err = self.t("summary :ids {:%Y-%m-%d} - {:%Y-%m-%d}".format(yesterday, tomorrow))
|
||||||
|
|
||||||
self.assertRegex(out, r"""
|
self.assertRegex(out, r"""
|
||||||
Wk ?Date Day ID Tags ?Start ?End Time Total
|
Wk ?Date Day ID Tags Annotation ?Start ?End Time Total
|
||||||
[ -]+
|
[ -]+
|
||||||
W\d{1,2} \d{4}-\d{2}-\d{2} .{3} @1 ?\d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2}(
|
W\d{1,2} \d{4}-\d{2}-\d{2} .{3} @1 ?\d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2}(
|
||||||
W\d{1,2} \d{4}-\d{2}-\d{2} .{3} @1 ?\d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2})?
|
W\d{1,2} \d{4}-\d{2}-\d{2} .{3} @1 ?\d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2})?
|
||||||
|
@ -77,7 +77,7 @@ W\d{1,2} \d{4}-\d{2}-\d{2} .{3} @1 ?\d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2
|
||||||
code, out, err = self.t("summary :ids :all".format(yesterday, tomorrow))
|
code, out, err = self.t("summary :ids :all".format(yesterday, tomorrow))
|
||||||
|
|
||||||
self.assertRegex(out, r"""
|
self.assertRegex(out, r"""
|
||||||
Wk ?Date Day ID Tags ?Start ?End Time Total
|
Wk ?Date Day ID Tags Annotation ?Start ?End Time Total
|
||||||
[ -]+
|
[ -]+
|
||||||
W\d{1,2} \d{4}-\d{2}-\d{2} .{3} @1 ?\d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2}(
|
W\d{1,2} \d{4}-\d{2}-\d{2} .{3} @1 ?\d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2}(
|
||||||
W\d{1,2} \d{4}-\d{2}-\d{2} .{3} @1 ?\d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2})?
|
W\d{1,2} \d{4}-\d{2}-\d{2} .{3} @1 ?\d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2})?
|
||||||
|
@ -96,7 +96,7 @@ W\d{1,2} \d{4}-\d{2}-\d{2} .{3} @1 ?\d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2
|
||||||
code, out, err = self.t("summary :ids {:%Y-%m-%d} - {:%Y-%m-%d}".format(yesterday, tomorrow))
|
code, out, err = self.t("summary :ids {:%Y-%m-%d} - {:%Y-%m-%d}".format(yesterday, tomorrow))
|
||||||
|
|
||||||
self.assertRegex(out, r"""
|
self.assertRegex(out, r"""
|
||||||
Wk ?Date Day ID Tags ?Start End Time Total
|
Wk ?Date Day ID Tags Annotation ?Start End Time Total
|
||||||
[ -]+
|
[ -]+
|
||||||
W\d{1,2} \d{4}-\d{2}-\d{2} .{3} @1 ?\d{1,2}:\d{2}:\d{2}[ ]+- \d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2}(
|
W\d{1,2} \d{4}-\d{2}-\d{2} .{3} @1 ?\d{1,2}:\d{2}:\d{2}[ ]+- \d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2}(
|
||||||
W\d{1,2} \d{4}-\d{2}-\d{2} .{3} @1 ?\d{1,2}:\d{2}:\d{2}[ ]+- \d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2})?
|
W\d{1,2} \d{4}-\d{2}-\d{2} .{3} @1 ?\d{1,2}:\d{2}:\d{2}[ ]+- \d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2})?
|
||||||
|
@ -115,7 +115,7 @@ W\d{1,2} \d{4}-\d{2}-\d{2} .{3} @1 ?\d{1,2}:\d{2}:\d{2}[ ]+- \d{1,2}:\d{2}
|
||||||
code, out, err = self.t("summary :ids :all".format(yesterday, tomorrow))
|
code, out, err = self.t("summary :ids :all".format(yesterday, tomorrow))
|
||||||
|
|
||||||
self.assertRegex(out, r"""
|
self.assertRegex(out, r"""
|
||||||
Wk ?Date Day ID Tags ?Start End Time Total
|
Wk ?Date Day ID Tags Annotation ?Start End Time Total
|
||||||
[ -]+
|
[ -]+
|
||||||
W\d{1,2} \d{4}-\d{2}-\d{2} .{3} @1 ?\d{1,2}:\d{2}:\d{2}[ ]+- \d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2}(
|
W\d{1,2} \d{4}-\d{2}-\d{2} .{3} @1 ?\d{1,2}:\d{2}:\d{2}[ ]+- \d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2}(
|
||||||
W\d{1,2} \d{4}-\d{2}-\d{2} .{3} @1 ?\d{1,2}:\d{2}:\d{2}[ ]+- \d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2})?
|
W\d{1,2} \d{4}-\d{2}-\d{2} .{3} @1 ?\d{1,2}:\d{2}:\d{2}[ ]+- \d{1,2}:\d{2}:\d{2} \d{1,2}:\d{2}:\d{2})?
|
||||||
|
@ -133,8 +133,8 @@ W\d{1,2} \d{4}-\d{2}-\d{2} .{3} @1 ?\d{1,2}:\d{2}:\d{2}[ ]+- \d{1,2}:\d{2}
|
||||||
code, out, err = self.t("summary 2017-03-09T11:00 - 2017-03-09T12:00 :ids")
|
code, out, err = self.t("summary 2017-03-09T11:00 - 2017-03-09T12:00 :ids")
|
||||||
|
|
||||||
self.assertIn("""
|
self.assertIn("""
|
||||||
Wk Date Day ID Tags Start End Time Total
|
Wk Date Day ID Tags Annotation Start End Time Total
|
||||||
--- ---------- --- -- ---------- -------- -------- ------- -------
|
--- ---------- --- -- ---------- ---------- -------- -------- ------- -------
|
||||||
W10 2017-03-09 Thu @3 Tag2 11:38:39 11:45:35 0:06:56
|
W10 2017-03-09 Thu @3 Tag2 11:38:39 11:45:35 0:06:56
|
||||||
@2 Tag2, Tag3 11:46:21 12:00:17 0:13:56 0:20:52
|
@2 Tag2, Tag3 11:46:21 12:00:17 0:13:56 0:20:52
|
||||||
|
|
||||||
|
@ -150,8 +150,8 @@ W10 2017-03-09 Thu @3 Tag2 11:38:39 11:45:35 0:06:56
|
||||||
code, out, err = self.t("summary 2017-03-10 :ids")
|
code, out, err = self.t("summary 2017-03-10 :ids")
|
||||||
|
|
||||||
self.assertIn("""
|
self.assertIn("""
|
||||||
Wk Date Day ID Tags Start End Time Total
|
Wk Date Day ID Tags Annotation Start End Time Total
|
||||||
--- ---------- --- -- ---- -------- -------- ------- -------
|
--- ---------- --- -- ---- ---------- -------- -------- ------- -------
|
||||||
W10 2017-03-10 Fri @2 10:00:00 11:00:00 1:00:00 1:00:00
|
W10 2017-03-10 Fri @2 10:00:00 11:00:00 1:00:00 1:00:00
|
||||||
|
|
||||||
1:00:00
|
1:00:00
|
||||||
|
@ -167,8 +167,8 @@ W10 2017-03-10 Fri @2 10:00:00 11:00:00 1:00:00 1:00:00
|
||||||
code, out, err = self.t("summary 2017-03-09 Tag1 :ids")
|
code, out, err = self.t("summary 2017-03-09 Tag1 :ids")
|
||||||
|
|
||||||
self.assertIn("""
|
self.assertIn("""
|
||||||
Wk Date Day ID Tags Start End Time Total
|
Wk Date Day ID Tags Annotation Start End Time Total
|
||||||
--- ---------- --- -- ---- ------- ------- ------- -------
|
--- ---------- --- -- ---- ---------- ------- ------- ------- -------
|
||||||
W10 2017-03-09 Thu @4 Tag1 8:43:08 9:38:15 0:55:07 0:55:07
|
W10 2017-03-09 Thu @4 Tag1 8:43:08 9:38:15 0:55:07 0:55:07
|
||||||
|
|
||||||
0:55:07
|
0:55:07
|
||||||
|
@ -184,8 +184,8 @@ W10 2017-03-09 Thu @4 Tag1 8:43:08 9:38:15 0:55:07 0:55:07
|
||||||
code, out, err = self.t("summary @2 @4 :ids")
|
code, out, err = self.t("summary @2 @4 :ids")
|
||||||
|
|
||||||
self.assertIn("""
|
self.assertIn("""
|
||||||
Wk Date Day ID Tags Start End Time Total
|
Wk Date Day ID Tags Annotation Start End Time Total
|
||||||
--- ---------- --- -- ---------- -------- -------- ------- -------
|
--- ---------- --- -- ---------- ---------- -------- -------- ------- -------
|
||||||
W10 2017-03-09 Thu @4 Tag1 8:43:08 9:38:15 0:55:07
|
W10 2017-03-09 Thu @4 Tag1 8:43:08 9:38:15 0:55:07
|
||||||
@2 Tag2, Tag3 11:46:21 12:00:17 0:13:56 1:09:03
|
@2 Tag2, Tag3 11:46:21 12:00:17 0:13:56 1:09:03
|
||||||
|
|
||||||
|
@ -202,8 +202,8 @@ W10 2017-03-09 Thu @4 Tag1 8:43:08 9:38:15 0:55:07
|
||||||
code, out, err = self.t("summary 2017-03-09 Tag1 :ids")
|
code, out, err = self.t("summary 2017-03-09 Tag1 :ids")
|
||||||
|
|
||||||
self.assertIn("""
|
self.assertIn("""
|
||||||
Wk Date Day ID Tags Start End Time Total
|
Wk Date Day ID Tags Annotation Start End Time Total
|
||||||
--- ---------- --- -- ---------- -------- -------- ------- -------
|
--- ---------- --- -- ---------- ---------- -------- -------- ------- -------
|
||||||
W10 2017-03-09 Thu @4 Tag1 8:43:08 9:38:15 0:55:07
|
W10 2017-03-09 Thu @4 Tag1 8:43:08 9:38:15 0:55:07
|
||||||
@2 Tag1, Tag3 11:46:21 12:00:17 0:13:56 1:09:03
|
@2 Tag1, Tag3 11:46:21 12:00:17 0:13:56 1:09:03
|
||||||
|
|
||||||
|
@ -229,8 +229,8 @@ W10 2017-03-09 Thu @4 Tag1 8:43:08 9:38:15 0:55:07
|
||||||
week_col_padding = 2 if (week_yesterday > 9 or week_now > 9 or week_tomorrow > 9) else 1
|
week_col_padding = 2 if (week_yesterday > 9 or week_now > 9 or week_tomorrow > 9) else 1
|
||||||
|
|
||||||
self.assertIn("""
|
self.assertIn("""
|
||||||
Wk{7: <{width}}Date Day ID Tags Start End Time Total
|
Wk{7: <{width}}Date Day ID Tags Annotation Start End Time Total
|
||||||
-{6:-<{width}} ---------- --- -- ---- -------- -------- ------- -------
|
-{6:-<{width}} ---------- --- -- ---- ---------- -------- -------- ------- -------
|
||||||
W{3: <{width}} {0:%Y-%m-%d} {0:%a} @3 FOO 10:00:00 11:00:00 1:00:00 1:00:00
|
W{3: <{width}} {0:%Y-%m-%d} {0:%a} @3 FOO 10:00:00 11:00:00 1:00:00 1:00:00
|
||||||
W{4: <{width}} {1:%Y-%m-%d} {1:%a} @2 BAR 10:00:00 11:00:00 1:00:00 1:00:00
|
W{4: <{width}} {1:%Y-%m-%d} {1:%a} @2 BAR 10:00:00 11:00:00 1:00:00 1:00:00
|
||||||
W{5: <{width}} {2:%Y-%m-%d} {2:%a} @1 BAZ 10:00:00 11:00:00 1:00:00 1:00:00
|
W{5: <{width}} {2:%Y-%m-%d} {2:%a} @1 BAZ 10:00:00 11:00:00 1:00:00 1:00:00
|
||||||
|
@ -271,8 +271,8 @@ W{5: <{width}} {2:%Y-%m-%d} {2:%a} @1 BAZ 10:00:00 11:00:00 1:00:00 1:00:00
|
||||||
two_digit_week = (week_yesterday > 9)
|
two_digit_week = (week_yesterday > 9)
|
||||||
|
|
||||||
self.assertIn("""
|
self.assertIn("""
|
||||||
Wk{2} Date Day ID Tags Start End Time Total
|
Wk{2} Date Day ID Tags Annotation Start End Time Total
|
||||||
--{3} ---------- --- -- ---- -------- -------- ------- -------
|
--{3} ---------- --- -- ---- ---------- -------- -------- ------- -------
|
||||||
W{1} {0:%Y-%m-%d} {0:%a} @3 FOO 10:00:00 11:00:00 1:00:00 1:00:00
|
W{1} {0:%Y-%m-%d} {0:%a} @3 FOO 10:00:00 11:00:00 1:00:00 1:00:00
|
||||||
|
|
||||||
{2} 1:00:00
|
{2} 1:00:00
|
||||||
|
@ -295,8 +295,8 @@ W{1} {0:%Y-%m-%d} {0:%a} @3 FOO 10:00:00 11:00:00 1:00:00 1:00:00
|
||||||
two_digit_week = (week_now > 9)
|
two_digit_week = (week_now > 9)
|
||||||
|
|
||||||
self.assertIn("""
|
self.assertIn("""
|
||||||
Wk{2} Date Day ID Tags Start End Time Total
|
Wk{2} Date Day ID Tags Annotation Start End Time Total
|
||||||
--{3} ---------- --- -- ---- -------- -------- ------- -------
|
--{3} ---------- --- -- ---- ---------- -------- -------- ------- -------
|
||||||
W{1} {0:%Y-%m-%d} {0:%a} @2 BAR 10:00:00 11:00:00 1:00:00 1:00:00
|
W{1} {0:%Y-%m-%d} {0:%a} @2 BAR 10:00:00 11:00:00 1:00:00 1:00:00
|
||||||
|
|
||||||
{2} 1:00:00
|
{2} 1:00:00
|
||||||
|
@ -310,8 +310,8 @@ W{1} {0:%Y-%m-%d} {0:%a} @2 BAR 10:00:00 11:00:00 1:00:00 1:00:00
|
||||||
code, out, err = self.t("summary 2017-03-09 - 2017-03-12 :ids")
|
code, out, err = self.t("summary 2017-03-09 - 2017-03-12 :ids")
|
||||||
|
|
||||||
self.assertIn("""
|
self.assertIn("""
|
||||||
Wk Date Day ID Tags Start End Time Total
|
Wk Date Day ID Tags Annotation Start End Time Total
|
||||||
--- ---------- --- -- ---- -------- -------- ------- -------
|
--- ---------- --- -- ---- ---------- -------- -------- ------- -------
|
||||||
W10 2017-03-09 Thu @2 10:00:00 11:00:00 1:00:00 1:00:00
|
W10 2017-03-09 Thu @2 10:00:00 11:00:00 1:00:00 1:00:00
|
||||||
W10 2017-03-11 Sat @1 10:00:00 11:00:00 1:00:00 1:00:00
|
W10 2017-03-11 Sat @1 10:00:00 11:00:00 1:00:00 1:00:00
|
||||||
|
|
||||||
|
@ -326,8 +326,8 @@ W10 2017-03-11 Sat @1 10:00:00 11:00:00 1:00:00 1:00:00
|
||||||
code, out, err = self.t("summary 2017-03-11 - 2017-03-14 :ids")
|
code, out, err = self.t("summary 2017-03-11 - 2017-03-14 :ids")
|
||||||
|
|
||||||
self.assertIn("""
|
self.assertIn("""
|
||||||
Wk Date Day ID Tags Start End Time Total
|
Wk Date Day ID Tags Annotation Start End Time Total
|
||||||
--- ---------- --- -- ---- -------- -------- ------- -------
|
--- ---------- --- -- ---- ---------- -------- -------- ------- -------
|
||||||
W10 2017-03-11 Sat @2 10:00:00 11:00:00 1:00:00 1:00:00
|
W10 2017-03-11 Sat @2 10:00:00 11:00:00 1:00:00 1:00:00
|
||||||
W11 2017-03-13 Mon @1 10:00:00 11:00:00 1:00:00 1:00:00
|
W11 2017-03-13 Mon @1 10:00:00 11:00:00 1:00:00 1:00:00
|
||||||
|
|
||||||
|
@ -346,8 +346,8 @@ W11 2017-03-13 Mon @1 10:00:00 11:00:00 1:00:00 1:00:00
|
||||||
code, out, err = self.t("summary 2017-03-09 - 2017-03-12 :ids")
|
code, out, err = self.t("summary 2017-03-09 - 2017-03-12 :ids")
|
||||||
|
|
||||||
self.assertIn("""
|
self.assertIn("""
|
||||||
Wk Date Day ID Tags Start End Time Total
|
Wk Date Day ID Tags Annotation Start End Time Total
|
||||||
--- ---------- --- -- ---- -------- -------- ------- -------
|
--- ---------- --- -- ---- ---------- -------- -------- ------- -------
|
||||||
W10 2017-03-09 Thu @6 FOO 10:00:00 11:00:00 1:00:00
|
W10 2017-03-09 Thu @6 FOO 10:00:00 11:00:00 1:00:00
|
||||||
@5 BAR 12:00:00 13:00:00 1:00:00
|
@5 BAR 12:00:00 13:00:00 1:00:00
|
||||||
@4 BAZ 14:00:00 15:00:00 1:00:00 3:00:00
|
@4 BAZ 14:00:00 15:00:00 1:00:00 3:00:00
|
||||||
|
@ -363,9 +363,9 @@ W10 2017-03-11 Sat @3 FOO 10:00:00 11:00:00 1:00:00
|
||||||
self.t("track sod - sod")
|
self.t("track sod - sod")
|
||||||
code, out, err = self.t("summary :year")
|
code, out, err = self.t("summary :year")
|
||||||
self.assertRegex(out, r"""
|
self.assertRegex(out, r"""
|
||||||
Wk ?Date Day Tags ?Start ?End Time Total
|
Wk ?Date Day ID Tags Annotation Start End Time Total
|
||||||
[ -]+
|
[ -]+
|
||||||
W\d{1,2} \d{4}-\d{2}-\d{2} .{3} ?0:00:00 0:00:00 0:00:00 0:00:00
|
W\d{1,2} \d{4}-\d{2}-\d{2} .{3} @1 0:00:00 0:00:00 0:00:00 0:00:00
|
||||||
|
|
||||||
[ ]+0:00:00
|
[ ]+0:00:00
|
||||||
""")
|
""")
|
||||||
|
|
|
@ -118,6 +118,9 @@ class TestUndo(TestCase):
|
||||||
|
|
||||||
def test_undo_config_add_name(self):
|
def test_undo_config_add_name(self):
|
||||||
"""Test undo of command 'config' (add name)"""
|
"""Test undo of command 'config' (add name)"""
|
||||||
|
self.t("config")
|
||||||
|
initial = [x for x in self.t.timewrc_content if x != '\n']
|
||||||
|
|
||||||
self.t("config foo bar :yes")
|
self.t("config foo bar :yes")
|
||||||
|
|
||||||
before = [x for x in self.t.timewrc_content if x != '\n']
|
before = [x for x in self.t.timewrc_content if x != '\n']
|
||||||
|
@ -127,7 +130,7 @@ class TestUndo(TestCase):
|
||||||
after = [x for x in self.t.timewrc_content if x != '\n']
|
after = [x for x in self.t.timewrc_content if x != '\n']
|
||||||
|
|
||||||
self.assertNotEqual(before, after)
|
self.assertNotEqual(before, after)
|
||||||
self.assertEqual([], after)
|
self.assertEqual(initial, after)
|
||||||
|
|
||||||
def test_undo_config_remove_name(self):
|
def test_undo_config_remove_name(self):
|
||||||
"""Test undo of command 'config' (remove name)"""
|
"""Test undo of command 'config' (remove name)"""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue