Skip to content

Commit fce89ef

Browse files
committed
Merge branch 'main' into changelog
2 parents d678597 + 25f7681 commit fce89ef

File tree

11 files changed

+256
-330
lines changed

11 files changed

+256
-330
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: CI
22
on: [push, pull_request]
33
env:
4-
GO_VERSION: '1.24'
5-
STATIC_CHECK_VERSION: '2025.1'
6-
COUNT_LOC_DOCKER_IMAGE: 'aldanial/cloc:2.02'
4+
GO_VERSION: '1.25'
5+
STATIC_CHECK_VERSION: '2025.1.1'
6+
COUNT_LOC_DOCKER_IMAGE: 'aldanial/cloc:2.06'
77
jobs:
88
statistics:
99
name: Statistics

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
description: 'Release id (tag name)'
77
required: true
88
env:
9-
GO_VERSION: '1.24'
9+
GO_VERSION: '1.25'
1010
jobs:
1111
create_release:
1212
name: Create release draft

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,26 @@ klog is a plain-text file format and a command line tool for time tracking.
1212

1313
📥 [Install](https://klog.jotaen.net#get-klog) – Get the latest version
1414

15-
📢 [Changelog](https://github.com/jotaen/klog/blob/main/CHANGELOG.md) – See what’s new
15+
📢 [Changelog](CHANGELOG.md) – See what’s new
16+
17+
💬 [Discussions](https://github.com/jotaen/klog/discussions) – Ask questions and share feedback
1618

1719
💡 [Specification](Specification.md) – Study the file format
1820

19-
## Contribute
21+
## Participate
2022

21-
If you have questions, feature ideas, or just want to bounce off some feedback,
23+
If you have questions, feedback, feature ideas, or want to report something that’s not working properly,
2224
feel invited to [start a discussion](https://github.com/jotaen/klog/discussions).
23-
In case you run into a bug, please [file an issue](https://github.com/jotaen/klog/issues).
24-
(When in doubt, just go for an issue.)
2525

26-
This repository contains the sources of the klog command line tool as well as
27-
the [specification document](Specification.md) of the klog file format.
28-
Note that both are technically independent of each other, which implies that
29-
they also have different version numbers.
26+
If you’d like to contribute code, please discuss your intended change beforehand. Please refrain from submitting pull requests proactively.
3027

3128
## About
3229

3330
klog was created by [Jan Heuermann](https://www.jotaen.net).
31+
3432
You are free to use it under the following terms:
3533

3634
- Command line tool: [MIT license](LICENSE.txt)
3735
- File specification: [public domain (CC0/OWFa)](Specification.md#License)
36+
37+
Note that the command line tool and the file format specification have independent version numbering schemes.

go.mod

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
module github.com/jotaen/klog
22

3-
go 1.24
3+
go 1.25
44

55
require (
6-
cloud.google.com/go v0.121.3
7-
github.com/alecthomas/kong v1.12.0
8-
github.com/jotaen/genie v0.0.1
9-
github.com/jotaen/kong-completion v0.0.6
10-
github.com/jotaen/safemath v0.0.1
6+
cloud.google.com/go v0.121.6
7+
github.com/alecthomas/kong v1.12.1
8+
github.com/jotaen/genie v0.0.2
9+
github.com/jotaen/kong-completion v0.0.7
10+
github.com/jotaen/safemath v0.0.2
1111
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
1212
github.com/posener/complete v1.2.3
13-
github.com/stretchr/testify v1.10.0
13+
github.com/stretchr/testify v1.11.1
1414
)
1515

1616
require (

go.sum

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
cloud.google.com/go v0.121.3 h1:84RD+hQXNdY5Sw/MWVAx5O9Aui/rd5VQ9HEcdN19afo=
2-
cloud.google.com/go v0.121.3/go.mod h1:6vWF3nJWRrEUv26mMB3FEIU/o1MQNVPG1iHdisa2SJc=
1+
cloud.google.com/go v0.121.6 h1:waZiuajrI28iAf40cWgycWNgaXPO06dupuS+sgibK6c=
2+
cloud.google.com/go v0.121.6/go.mod h1:coChdst4Ea5vUpiALcYKXEpR1S9ZgXbhEzzMcMR66vI=
33
github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0=
44
github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
5-
github.com/alecthomas/kong v1.12.0 h1:oKd/0fHSdajj5PfGDd3ScvEvpVJf9mT2mb5r9xYadYM=
6-
github.com/alecthomas/kong v1.12.0/go.mod h1:p2vqieVMeTAnaC83txKtXe8FLke2X07aruPWXyMPQrU=
5+
github.com/alecthomas/kong v1.12.1 h1:iq6aMJDcFYP9uFrLdsiZQ2ZMmcshduyGv4Pek0MQPW0=
6+
github.com/alecthomas/kong v1.12.1/go.mod h1:p2vqieVMeTAnaC83txKtXe8FLke2X07aruPWXyMPQrU=
77
github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc=
88
github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
99
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -19,12 +19,12 @@ github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+l
1919
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
2020
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
2121
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
22-
github.com/jotaen/genie v0.0.1 h1:gURxhYIpVEJ7SKjjNRDLV5OrgMxCbkAdWhjD86ad9P8=
23-
github.com/jotaen/genie v0.0.1/go.mod h1:bu+PbJDEJ9915yp4xml7OXoM4iBsSDfgtGVwv5Ag0Gg=
24-
github.com/jotaen/kong-completion v0.0.6 h1:VP1KGvXPeB7MytYR+zZQoWw1gf/HIV1/EvWC38BHZN4=
25-
github.com/jotaen/kong-completion v0.0.6/go.mod h1:fuWw9snL6joY5mXbI0Dd5FWEZODaWXAeqaRxo6dAvLk=
26-
github.com/jotaen/safemath v0.0.1 h1:YcUhSIUtwQY1rUUT3AeP+alzTHUAsM4Pap8ZMn3GOlc=
27-
github.com/jotaen/safemath v0.0.1/go.mod h1:KlKBnI3qvGcr3+iuvp3vABBZNFRjRcwRUVQa/jM38xQ=
22+
github.com/jotaen/genie v0.0.2 h1:arXxp5faTubDwRbKr6ZHHMaHSmo5cdMSfTIctbwF50s=
23+
github.com/jotaen/genie v0.0.2/go.mod h1:5v0pWbZ+yHWL8QIfTq1PSuUuoGQ1enQZ4XTtV/PnJos=
24+
github.com/jotaen/kong-completion v0.0.7 h1:l2UrG51q0gWD8Ph0CykBvGOb1YlXDc789AQnWkq+U9M=
25+
github.com/jotaen/kong-completion v0.0.7/go.mod h1:dtitX9zCkffI5AON0IKsqHOFEEaL/S2AudgzJfCVFA4=
26+
github.com/jotaen/safemath v0.0.2 h1:jH9Bx0c9XmZylZD51Rs0Ojcs0jMcN636E2RgtTCUzOU=
27+
github.com/jotaen/safemath v0.0.2/go.mod h1:6DmgN+FzJxAYVAdKLR0KZl8i+gpj+7yD/bPdpi7qxfU=
2828
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
2929
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
3030
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
@@ -35,8 +35,8 @@ github.com/riywo/loginshell v0.0.0-20200815045211-7d26008be1ab h1:ZjX6I48eZSFetP
3535
github.com/riywo/loginshell v0.0.0-20200815045211-7d26008be1ab/go.mod h1:/PfPXh0EntGc3QAAyUaviy4S9tzy4Zp0e2ilq4voC6E=
3636
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
3737
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
38-
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
39-
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
38+
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
39+
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
4040
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
4141
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
4242
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

klog.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ package main
33
import (
44
_ "embed"
55
"fmt"
6+
"os"
7+
"runtime"
8+
69
"github.com/jotaen/klog/klog/app"
710
"github.com/jotaen/klog/klog/app/cli/util"
811
"github.com/jotaen/klog/klog/app/main"
9-
"os"
10-
"runtime"
1112
)
1213

1314
//go:embed Specification.md
@@ -41,11 +42,7 @@ func main() {
4142
}()
4243

4344
config := func() app.Config {
44-
c, err := app.NewConfig(
45-
app.FromDeterminedValues{NumCpus: runtime.NumCPU()},
46-
app.FromEnvVars{GetVar: os.Getenv},
47-
app.FromConfigFile{FileContents: configFile},
48-
)
45+
c, err := app.NewConfig(runtime.NumCPU(), os.Getenv, configFile)
4946
if err != nil {
5047
fail(util.PrettifyAppError(err, false), app.CONFIG_ERROR.ToInt())
5148
}

klog/app/cli/config.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package cli
22

33
import (
4+
"path/filepath"
5+
"strings"
6+
47
"github.com/jotaen/klog/klog/app"
58
tf "github.com/jotaen/klog/klog/app/cli/terminalformat"
69
"github.com/jotaen/klog/klog/app/cli/util"
7-
"path/filepath"
8-
"strings"
910
)
1011

1112
type Config struct {
@@ -27,7 +28,7 @@ klog relies on file-based configuration to customise some of its default behavio
2728
2829
Run 'klog config --location' to print the path of the folder where klog looks for the configuration.
2930
The config folder can contain one or both of the following files:
30-
- '` + app.CONFIG_FILE_NAME + `': you can create this file manually to override some of klog’s default behaviour. You may use the output of the 'klog config' command as template for setting up this file, as its output is in valid syntax.
31+
- '` + app.CONFIG_FILE_NAME + `': you can create this file manually to override some of klog’s default behaviour. You may use the output of the 'klog config' command as template for setting up this file, as its output is valid .ini syntax.
3132
- '` + app.BOOKMARKS_FILE_NAME + `': if you use the bookmarks functionality, then klog uses this file as database. You are not supposed to edit this file by hand! Instead, use the 'klog bookmarks' command to manage your bookmarks.
3233
3334
You can customise the location of the config folder via environment variables. klog uses the following lookup precedence:

klog/app/cli/info.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ func (opt *Info) Run(ctx app.Context) app.Error {
1818
} else if opt.About {
1919
ctx.Print(INTRO_SUMMARY)
2020
} else {
21-
ctx.Print("Use --spec or --license\n")
21+
return app.NewErrorWithCode(
22+
app.GENERAL_ERROR,
23+
"No flag specified",
24+
"Run with `--help` for more info",
25+
nil,
26+
)
2227
}
2328
return nil
2429
}

klog/app/cli/testcontext_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
package cli
22

33
import (
4+
gotime "time"
5+
46
"github.com/jotaen/klog/klog"
57
"github.com/jotaen/klog/klog/app"
68
"github.com/jotaen/klog/klog/app/cli/command"
79
tf "github.com/jotaen/klog/klog/app/cli/terminalformat"
810
"github.com/jotaen/klog/klog/parser"
911
"github.com/jotaen/klog/klog/parser/reconciling"
1012
"github.com/jotaen/klog/klog/parser/txt"
11-
gotime "time"
1213
)
1314

1415
func NewTestingContext() TestingContext {
@@ -63,11 +64,11 @@ func (ctx TestingContext) _SetFileExplorers(cs []command.Command) TestingContext
6364
}
6465

6566
func (ctx TestingContext) _SetFileConfig(configFile string) TestingContext {
66-
fileCfg := app.FromConfigFile{FileContents: configFile}
67-
err := fileCfg.Apply(ctx.config)
67+
cfg, err := app.NewConfig(1, func(_ string) string { return "" }, configFile)
6868
if err != nil {
6969
panic(err)
7070
}
71+
ctx.config = &cfg
7172
return ctx
7273
}
7374

0 commit comments

Comments
 (0)