File tree Expand file tree Collapse file tree 8 files changed +376
-272
lines changed
Expand file tree Collapse file tree 8 files changed +376
-272
lines changed Original file line number Diff line number Diff line change 11# Changelog (command line tool)
22
33## v2.5
4- - ** [ FEATURE ] ** Restructure output of ` klog now ` , especially when
5- using the ` --diff ` flag
4+ - ** [ BREAKING ] ** Rename ` klog now ` to ` klog today ` ; restructure the
5+ output, especially when using the ` --diff ` / ` --now ` flag
66- ** [ FEATURE ] ** Use distinct exit codes for different error cases
77- ** [ FEATURE ] ** Introduce ` --quiet ` flag to retrieve raw output
88- ** [ FEATURE ] ** Extend help texts, improve error messages
Original file line number Diff line number Diff line change 11package cli
22
3+ import (
4+ "errors"
5+ "klog/app"
6+ )
7+
38type Cli struct {
49 // Evaluate
510 Print Print `cmd group:"Evaluate" help:"Pretty-prints records"`
611 Total Total `cmd group:"Evaluate" help:"Evaluates the total time"`
712 Report Report `cmd group:"Evaluate" help:"Prints a calendar report summarising all days"`
813 Tags Tags `cmd group:"Evaluate" help:"Prints total times aggregated by tags"`
9- Now Now `cmd group:"Evaluate" help:"Show overview of the current day"`
14+ Today Today `cmd group:"Evaluate" help:"Evaluate current day"`
15+ Now Now `cmd group:"Evaluate" hidden help:"Show overview of the current day"`
1016
1117 // Manipulate
1218 Track Track `cmd group:"Manipulate" help:"Adds a new entry to a record"`
@@ -20,3 +26,12 @@ type Cli struct {
2026 Widget Widget `cmd group:"Misc" help:"Starts menu bar widget (MacOS only)"`
2127 Version Version `cmd group:"Misc" help:"Prints version info and check for updates"`
2228}
29+
30+ // DEPRECATED
31+ type Now struct {
32+ Today
33+ }
34+
35+ func (opt * Now ) Run (_ app.Context ) error {
36+ return errors .New ("`klog now` has been renamed to `klog today`. Note that the `--now` flag must be passed explicitly." )
37+ }
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ func (opt *Report) Run(ctx app.Context) error {
8787 }
8888 ctx .Print ("\n " )
8989 grandTotal := opt .NowArgs .Total (now , records ... )
90- ctx .Print (indentation + lib .Pad (9 - len (grandTotal .ToStringWithSign ())) + ctx .Serialiser ().SignedDuration (grandTotal ))
90+ ctx .Print (indentation + lib .Pad (9 - len (grandTotal .ToString ())) + ctx .Serialiser ().Duration (grandTotal ))
9191 if opt .Diff {
9292 grandShould := service .ShouldTotalSum (records ... )
9393 ctx .Print (lib .Pad (10 - len (grandShould .ToString ())) + ctx .Serialiser ().ShouldTotal (grandShould ))
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ func TestReportOfRecords(t *testing.T) {
5353 Mar Tue 2. -8h2m
5454 Wed 3. 1h
5555 ========
56- + 335h50m
56+ 335h50m
5757` , state .printBuffer )
5858}
5959
@@ -77,7 +77,7 @@ func TestReportConsecutive(t *testing.T) {
7777 Sat 3.
7878 Sun 4. 3h
7979 ========
80- + 4h
80+ 4h
8181` , state .printBuffer )
8282}
8383
@@ -101,6 +101,6 @@ func TestReportWithDiff(t *testing.T) {
101101 Sun 8. 2h 5h30m! -3h30m
102102 Mon 9. 5h20m 2h19m! +3h1m
103103 ===========================
104- + 15h20m 15h49m! -29m
104+ 15h20m 15h49m! -29m
105105` , state .printBuffer )
106106}
You can’t perform that action at this time.
0 commit comments