Skip to content

Commit 05a7efd

Browse files
committed
Create v0.2.3 release, add --keephistory flag
1 parent 0b896e1 commit 05a7efd

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

changelog.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919

2020
### Security
2121

22+
## [0.2.3] - 2024-06-01
23+
24+
### Changed
25+
26+
- Reload chat history when changing room, with an option to keep history
27+
2228
## [0.2.2] - 2024-06-01
2329

2430
### Fixed
@@ -71,7 +77,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7177
- Go programs for [client](./tui/main.go) and [server](./server/main.go)
7278
- GitHub Actions release flow, including binaries
7379

74-
[unreleased]: https://github.com/supleed2/go-chat/compare/v0.2.2...HEAD
80+
[unreleased]: https://github.com/supleed2/go-chat/compare/v0.2.3...HEAD
81+
[0.2.3]: https://github.com/supleed2/go-chat/releases/tag/v0.2.3
7582
[0.2.2]: https://github.com/supleed2/go-chat/releases/tag/v0.2.2
7683
[0.2.1]: https://github.com/supleed2/go-chat/releases/tag/v0.2.1
7784
[0.2.0]: https://github.com/supleed2/go-chat/releases/tag/v0.2.0

client/main.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ const (
5252
)
5353

5454
type model struct {
55+
kpHist bool
5556
history viewport.Model
5657
msgs []c.SMsg
5758
showTim showTim
@@ -67,15 +68,17 @@ type model struct {
6768
}
6869

6970
type args struct {
70-
Address string `arg:"positional" default:"gochat.8bit.lol" help:"address to connect to, without ws://" placeholder:"HOST[:PORT]"`
71-
Timestamps showTim `arg:"-t" default:"off" help:"display timestamps of messages, ctrl+t to cycle after startup [off, short, full]" placeholder:"CHOICE"`
72-
Nick *string `arg:"-n" help:"attempt to automatically set nick after connecting"`
73-
Password *string `arg:"-p" help:"password, if required"`
71+
Address string `arg:"positional" default:"gochat.8bit.lol" help:"address to connect to, without ws://" placeholder:"HOST[:PORT]"`
72+
KeepHistory bool `arg:"-k" help:"append chat history when changing rooms, instead of clearing"`
73+
Timestamps showTim `arg:"-t" default:"off" help:"display timestamps of messages, ctrl+t to cycle after startup [off, short, full]" placeholder:"CHOICE"`
74+
Nick *string `arg:"-n" help:"attempt to automatically set nick after connecting"`
75+
Password *string `arg:"-p" help:"password, if required"`
7476
}
7577

7678
func (a *args) Version() string {
77-
return "v0.2.1"
79+
return "v0.2.3"
7880
}
81+
7982
func (a *args) Description() string {
8083
return "Go, chat!\nA basic irc-style chat client, written in Go using bubbletea and websockets"
8184
}
@@ -180,6 +183,7 @@ func initModel(ctx context.Context, conn *ws.Conn, a args, tz time.Location) mod
180183
msgs: messages,
181184
showTim: a.Timestamps,
182185
tz: tz,
186+
kpHist: a.KeepHistory,
183187
history: vp,
184188
idStyle: lipgloss.NewStyle().Width(60),
185189
pStyle: lipgloss.NewStyle().Bold(true),
@@ -230,6 +234,9 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
230234
} else if text == "ls" {
231235
m.sendCh <- c.CMsg{Typ: c.Ls, Msg: ""}
232236
} else if text, ok := strings.CutPrefix(text, "cd "); ok {
237+
if !m.kpHist {
238+
m.msgs = []c.SMsg{}
239+
}
233240
m.sendCh <- c.CMsg{Typ: c.Cd, Msg: text}
234241
} else if text == "who" {
235242
m.sendCh <- c.CMsg{Typ: c.Who, Msg: ""}

server/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const createRoomTable = "CREATE TABLE IF NOT EXISTS %s (tim DATETIME, id TEXT, m
6363
const insertRoomMsg = "INSERT INTO %v (tim, id, msg) VALUES (:tim, :id, :msg)"
6464

6565
func (a *args) Version() string {
66-
return "v0.2.1"
66+
return "v0.2.3"
6767
}
6868

6969
func (a *args) Description() string {

0 commit comments

Comments
 (0)