Compare commits

..

6 commits

Author SHA1 Message Date
aaad07bc77 fix: update module github.com/charmbracelet/bubbletea to v1.2.1 2024-11-09 02:02:05 +00:00
4985dc207a fix: update module git.smsvc.net/pomodoro/gotomato to v0.2.0 2024-11-07 21:55:35 +00:00
809b6e07da fix: update module github.com/charmbracelet/bubbletea to v1.2.0 2024-11-07 21:40:27 +00:00
359017968d feat: set version from git tag on build
- add version variable and default it to "devel"
- add ldflags to `.goreleaser.yaml` for version tagging
2024-11-07 20:51:41 +01:00
aef9bdfff7 feat(goreleaser): add initial configuration for GoReleaser
- add `.goreleaser.yaml` for release automation
- add `dist` to gitignore
2024-11-07 20:51:41 +01:00
9c4d43a4d3 feat: reconnect on disconnect (status in TUI)
- add `Connected()` method for client
- add `LastErr` field to GoTomatoClient
  - replace error logging by updating `LastErr` field
  - modify methods to use pointer receivers for Client
- add `prevMessage` variable to store the last received server message
- show connect status in TUI
- use EnterAltScreen instead of ClearScreen
2024-11-07 20:13:25 +01:00
6 changed files with 18 additions and 81 deletions

View file

@ -1,10 +1,10 @@
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
version: 2
before:
hooks:
- rm -fr ./dist
- go mod tidy
builds:
@ -16,7 +16,7 @@ builds:
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X {{.ModulePath}}/internal/metadata.ChronoTomatoVersion={{.Version}}
- -s -w -X git.smsvc.net/pomodoro/ChronoTomato/cmd/client.version={{.Version}}
upx:
- enabled: true

View file

@ -1,34 +0,0 @@
# yaml-language-server: $schema=https://taskfile.dev/schema.json
#
# github.com/go-task/task/v3/cmd/task@latest
# Requirements:
# github.com/caarlos0/svu@latest
# github.com/goreleaser/goreleaser/v2@latest
version: '3'
tasks:
release:
desc: Create and publish an new release
vars:
RELEASE:
sh: svu next
BRANCH:
sh: git branch --show-current
COMMIT:
sh: git rev-parse --short --verify {{.BRANCH}}
preconditions:
- sh: test "{{.BRANCH}}" == "main"
msg: "You must be on the main branch to release"
prompt: Create new release {{.RELEASE}} from {{.COMMIT}}@{{.BRANCH}}?
cmds:
- git tag {{.RELEASE}}
- git push
- git push origin tag {{.RELEASE}}
- goreleaser release --clean
snapshot:
desc: Create a local snapshot release
cmds:
- goreleaser release --clean --snapshot

View file

@ -6,7 +6,6 @@ import (
"os"
"git.smsvc.net/pomodoro/ChronoTomato/internal/helper"
"git.smsvc.net/pomodoro/ChronoTomato/internal/metadata"
"git.smsvc.net/pomodoro/ChronoTomato/internal/websocket"
ChronoTomato "git.smsvc.net/pomodoro/ChronoTomato/pkg/models"
GoTomato "git.smsvc.net/pomodoro/GoTomato/pkg/models"
@ -16,6 +15,7 @@ import (
)
var (
version = "devel"
config ChronoTomato.Config
client websocket.Client
)
@ -76,7 +76,7 @@ func Start() {
flag.Parse()
if *showVersion {
fmt.Println("ChronoTomato", metadata.ChronoTomatoVersion)
fmt.Println("ChronoTomato", version)
os.Exit(0)
}

8
go.mod
View file

@ -3,10 +3,10 @@ module git.smsvc.net/pomodoro/ChronoTomato
go 1.23.1
require (
git.smsvc.net/pomodoro/GoTomato v0.0.8
git.smsvc.net/pomodoro/GoTomato v0.2.0
github.com/alecthomas/colour v0.1.0
github.com/charmbracelet/bubbles v0.20.0
github.com/charmbracelet/bubbletea v1.1.2
github.com/charmbracelet/bubbletea v1.2.1
github.com/charmbracelet/log v0.4.0
github.com/gen2brain/beeep v0.0.0-20240516210008-9c006672e7f4
github.com/gorilla/websocket v1.5.3
@ -15,8 +15,8 @@ require (
require (
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/charmbracelet/lipgloss v0.13.0 // indirect
github.com/charmbracelet/x/ansi v0.4.0 // indirect
github.com/charmbracelet/lipgloss v1.0.0 // indirect
github.com/charmbracelet/x/ansi v0.4.5 // indirect
github.com/charmbracelet/x/term v0.2.0 // indirect
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect

16
go.sum
View file

@ -1,19 +1,19 @@
git.smsvc.net/pomodoro/GoTomato v0.0.8 h1:ePD6T14pFtrtXybHypabpDs4MURdOnPkm8nQzzEteVA=
git.smsvc.net/pomodoro/GoTomato v0.0.8/go.mod h1:LaKrPdnFB5v4RpltExKasW67TmjJlmhDDvmoEYWv0P4=
git.smsvc.net/pomodoro/GoTomato v0.2.0 h1:/Wkft5ESsKNJIKiu6OJ7sKvY8LhW6acpTcMy89DLd0s=
git.smsvc.net/pomodoro/GoTomato v0.2.0/go.mod h1:LaKrPdnFB5v4RpltExKasW67TmjJlmhDDvmoEYWv0P4=
github.com/alecthomas/colour v0.1.0 h1:nOE9rJm6dsZ66RGWYSFrXw461ZIt9A6+nHgL7FRrDUk=
github.com/alecthomas/colour v0.1.0/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0=
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
github.com/charmbracelet/bubbles v0.20.0 h1:jSZu6qD8cRQ6k9OMfR1WlM+ruM8fkPWkHvQWD9LIutE=
github.com/charmbracelet/bubbles v0.20.0/go.mod h1:39slydyswPy+uVOHZ5x/GjwVAFkCsV8IIVy+4MhzwwU=
github.com/charmbracelet/bubbletea v1.1.2 h1:naQXF2laRxyLyil/i7fxdpiz1/k06IKquhm4vBfHsIc=
github.com/charmbracelet/bubbletea v1.1.2/go.mod h1:9HIU/hBV24qKjlehyj8z1r/tR9TYTQEag+cWZnuXo8E=
github.com/charmbracelet/lipgloss v0.13.0 h1:4X3PPeoWEDCMvzDvGmTajSyYPcZM4+y8sCA/SsA3cjw=
github.com/charmbracelet/lipgloss v0.13.0/go.mod h1:nw4zy0SBX/F/eAO1cWdcvy6qnkDUxr8Lw7dvFrAIbbY=
github.com/charmbracelet/bubbletea v1.2.1 h1:J041h57zculJKEKf/O2pS4edXGIz+V0YvojvfGXePIk=
github.com/charmbracelet/bubbletea v1.2.1/go.mod h1:viLoDL7hG4njLJSKU2gw7kB3LSEmWsrM80rO1dBJWBI=
github.com/charmbracelet/lipgloss v1.0.0 h1:O7VkGDvqEdGi93X+DeqsQ7PKHDgtQfF8j8/O2qFMQNg=
github.com/charmbracelet/lipgloss v1.0.0/go.mod h1:U5fy9Z+C38obMs+T+tJqst9VGzlOYGj4ri9reL3qUlo=
github.com/charmbracelet/log v0.4.0 h1:G9bQAcx8rWA2T3pWvx7YtPTPwgqpk7D68BX21IRW8ZM=
github.com/charmbracelet/log v0.4.0/go.mod h1:63bXt/djrizTec0l11H20t8FDSvA4CRZJ1KH22MdptM=
github.com/charmbracelet/x/ansi v0.4.0 h1:NqwHA4B23VwsDn4H3VcNX1W1tOmgnvY1NDx5tOXdnOU=
github.com/charmbracelet/x/ansi v0.4.0/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw=
github.com/charmbracelet/x/ansi v0.4.5 h1:LqK4vwBNaXw2AyGIICa5/29Sbdq58GbGdFngSexTdRM=
github.com/charmbracelet/x/ansi v0.4.5/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw=
github.com/charmbracelet/x/term v0.2.0 h1:cNB9Ot9q8I711MyZ7myUR5HFWL/lc3OpU8jZ4hwm0x0=
github.com/charmbracelet/x/term v0.2.0/go.mod h1:GVxgxAbjUrmpvIINHIQnJJKpMlHiZ4cktEQCN6GWyF0=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=

View file

@ -1,29 +0,0 @@
package metadata
import (
"os/exec"
"runtime/debug"
"strings"
)
var ChronoTomatoVersion = ""
func getLatestTag() string {
bytes, _ := exec.Command("git", "describe", "--tags").Output()
output := strings.TrimSpace(string(bytes))
return output
}
// set GoTomatoVersion from runtime/debug.Main.Version
// use latest git tag as fallback
// can be overwritten via ldflags (e,g. by goreleaser)
func init() {
if ChronoTomatoVersion == "" {
info, _ := debug.ReadBuildInfo()
if info.Main.Version != "(devel)" {
ChronoTomatoVersion = info.Main.Version
} else {
ChronoTomatoVersion = getLatestTag()
}
}
}