Create v0.2.3 release, add --keephistory flag

This commit is contained in:
Aadi Desai 2024-06-01 17:31:45 +01:00
parent 0b896e1611
commit 05a7efd223
Signed by: supleed2
SSH key fingerprint: SHA256:CkbNRs0yVzXEiUp2zd0PSxsfRUMFF9bLlKXtE1xEbKM
3 changed files with 21 additions and 7 deletions

View file

@ -19,6 +19,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Security ### Security
## [0.2.3] - 2024-06-01
### Changed
- Reload chat history when changing room, with an option to keep history
## [0.2.2] - 2024-06-01 ## [0.2.2] - 2024-06-01
### Fixed ### Fixed
@ -71,7 +77,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Go programs for [client](./tui/main.go) and [server](./server/main.go) - Go programs for [client](./tui/main.go) and [server](./server/main.go)
- GitHub Actions release flow, including binaries - GitHub Actions release flow, including binaries
[unreleased]: https://github.com/supleed2/go-chat/compare/v0.2.2...HEAD [unreleased]: https://github.com/supleed2/go-chat/compare/v0.2.3...HEAD
[0.2.3]: https://github.com/supleed2/go-chat/releases/tag/v0.2.3
[0.2.2]: https://github.com/supleed2/go-chat/releases/tag/v0.2.2 [0.2.2]: https://github.com/supleed2/go-chat/releases/tag/v0.2.2
[0.2.1]: https://github.com/supleed2/go-chat/releases/tag/v0.2.1 [0.2.1]: https://github.com/supleed2/go-chat/releases/tag/v0.2.1
[0.2.0]: https://github.com/supleed2/go-chat/releases/tag/v0.2.0 [0.2.0]: https://github.com/supleed2/go-chat/releases/tag/v0.2.0

View file

@ -52,6 +52,7 @@ const (
) )
type model struct { type model struct {
kpHist bool
history viewport.Model history viewport.Model
msgs []c.SMsg msgs []c.SMsg
showTim showTim showTim showTim
@ -67,15 +68,17 @@ type model struct {
} }
type args struct { type args struct {
Address string `arg:"positional" default:"gochat.8bit.lol" help:"address to connect to, without ws://" placeholder:"HOST[:PORT]"` Address string `arg:"positional" default:"gochat.8bit.lol" help:"address to connect to, without ws://" placeholder:"HOST[:PORT]"`
Timestamps showTim `arg:"-t" default:"off" help:"display timestamps of messages, ctrl+t to cycle after startup [off, short, full]" placeholder:"CHOICE"` KeepHistory bool `arg:"-k" help:"append chat history when changing rooms, instead of clearing"`
Nick *string `arg:"-n" help:"attempt to automatically set nick after connecting"` Timestamps showTim `arg:"-t" default:"off" help:"display timestamps of messages, ctrl+t to cycle after startup [off, short, full]" placeholder:"CHOICE"`
Password *string `arg:"-p" help:"password, if required"` Nick *string `arg:"-n" help:"attempt to automatically set nick after connecting"`
Password *string `arg:"-p" help:"password, if required"`
} }
func (a *args) Version() string { func (a *args) Version() string {
return "v0.2.1" return "v0.2.3"
} }
func (a *args) Description() string { func (a *args) Description() string {
return "Go, chat!\nA basic irc-style chat client, written in Go using bubbletea and websockets" return "Go, chat!\nA basic irc-style chat client, written in Go using bubbletea and websockets"
} }
@ -180,6 +183,7 @@ func initModel(ctx context.Context, conn *ws.Conn, a args, tz time.Location) mod
msgs: messages, msgs: messages,
showTim: a.Timestamps, showTim: a.Timestamps,
tz: tz, tz: tz,
kpHist: a.KeepHistory,
history: vp, history: vp,
idStyle: lipgloss.NewStyle().Width(60), idStyle: lipgloss.NewStyle().Width(60),
pStyle: lipgloss.NewStyle().Bold(true), pStyle: lipgloss.NewStyle().Bold(true),
@ -230,6 +234,9 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
} else if text == "ls" { } else if text == "ls" {
m.sendCh <- c.CMsg{Typ: c.Ls, Msg: ""} m.sendCh <- c.CMsg{Typ: c.Ls, Msg: ""}
} else if text, ok := strings.CutPrefix(text, "cd "); ok { } else if text, ok := strings.CutPrefix(text, "cd "); ok {
if !m.kpHist {
m.msgs = []c.SMsg{}
}
m.sendCh <- c.CMsg{Typ: c.Cd, Msg: text} m.sendCh <- c.CMsg{Typ: c.Cd, Msg: text}
} else if text == "who" { } else if text == "who" {
m.sendCh <- c.CMsg{Typ: c.Who, Msg: ""} m.sendCh <- c.CMsg{Typ: c.Who, Msg: ""}

View file

@ -63,7 +63,7 @@ const createRoomTable = "CREATE TABLE IF NOT EXISTS %s (tim DATETIME, id TEXT, m
const insertRoomMsg = "INSERT INTO %v (tim, id, msg) VALUES (:tim, :id, :msg)" const insertRoomMsg = "INSERT INTO %v (tim, id, msg) VALUES (:tim, :id, :msg)"
func (a *args) Version() string { func (a *args) Version() string {
return "v0.2.1" return "v0.2.3"
} }
func (a *args) Description() string { func (a *args) Description() string {