feat: the changelog in the status pane, built in (#12)
The status pane's rows (`0`, then `enter`) end with the changelog: every release up to the running one, newest first.
```
v0.2.0 2026-10-12
added: Search with fzf's scoring and query syntax (#11) (65dc2d7)
fixed: …
v0.1.0 2026-10-10
Hello world 👋
```
- `CHANGELOG.md` is embedded at build time by a small root package (`changelog.go`, `package lazysecrets`, `//go:embed`), so it needs no network and matches the binary. `release.sh` updates the file before tagging, so a release's binary includes its own entry. `go install …@latest` gets it too, since the module includes the file.
- Entries show as text: links become `(#11) (65dc2d7)` (`update.PlainLinks`, shared with the `U` notes). `/` filters them like any Fields pane (`/fixed`, `/search`), and `y` copies one.
- `cliff.toml`: #11 was squash-merged with #10 (the status pane) in it, so a preprocessor rewrites its entry to name both. Otherwise the status pane would be missing from the changelog.
Test for the parsing: versions and dates, kinds, links as text, a release's own words, and the header and footer left out.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Karl-Einar Bergstrøm <karl-einarb@outlook.com>
Reviewed-on: #12
This commit was merged in pull request #12.
This commit is contained in:
1 parent
56d3d25c9c
commit
9b0329e9da
8 files changed
+98
-6
No files matched your search
@@ -0,0 +1,30 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"git.kebcloud.no/keb/lazysecrets/internal/ui/panes"
|
||||
)
|
||||
|
||||
func TestChangelogFields(t *testing.T) {
|
||||
t.Parallel()
|
||||
md := "# Changelog\n\nEvery release of lazysecrets, newest first.\n\n## v0.2.0 – 2026-10-12\n\n### Added\n\n" +
|
||||
"- Search ([#11](https://x/pulls/11)) ([65dc2d7](https://x/commit/65dc2d7))\n\n### Fixed\n\n- A fix (#3)\n\n" +
|
||||
"## v0.1.0 – 2026-10-10\n\nHello world 👋\n\n<!-- generated by git-cliff (cliff.toml) -->\n"
|
||||
got := changelogFields(md)
|
||||
want := []panes.Field{
|
||||
{Label: "v0.2.0", Value: "2026-10-12", Info: true},
|
||||
{Value: "added: Search (#11) (65dc2d7)"},
|
||||
{Value: "fixed: A fix (#3)"},
|
||||
{Label: "v0.1.0", Value: "2026-10-10", Info: true},
|
||||
{Value: "Hello world 👋"},
|
||||
}
|
||||
if len(got) != len(want) {
|
||||
t.Fatalf("got %+v", got)
|
||||
}
|
||||
for i := range want {
|
||||
if got[i] != want[i] {
|
||||
t.Errorf("row %d: %+v, want %+v", i, got[i], want[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user