ref: a8234dc3c631ff8477654661683f852d61575218
parent: 4a7a258c3973ea05fdbc340150b780c4155c02a9
author: penny <penny@limitedideas.org>
date: Sat Aug 9 16:00:50 EDT 2025
pausing functions work
--- a/hellclient.go
+++ b/hellclient.go
@@ -6,8 +6,9 @@
)
type Hellclient struct {- isPaused bool
- rl *readline.Instance
+ isPaused bool
+ rl *readline.Instance
+ pauseChan chan bool
}
func NewHellclient() (*Hellclient, error) {@@ -15,7 +16,7 @@
if err != nil {return nil, err
}
- return &Hellclient{rl: rl}, nil+ return &Hellclient{rl: rl, pauseChan: make(chan bool)}, nil}
func (hc *Hellclient) updatePrompt() {@@ -27,4 +28,14 @@
hc.rl.SetPrompt(sb.String())
}
+func (hc *Hellclient) pause(on bool) {+ hc.isPaused = on
+ hc.pauseChan <- hc.isPaused
+ hc.updatePrompt()
+}
+func (hc *Hellclient) togglepause() {+ hc.isPaused = !hc.isPaused
+ hc.pauseChan <- hc.isPaused
+ hc.updatePrompt()
+}
--- a/main.go
+++ b/main.go
@@ -48,8 +48,7 @@
return
}
- pauseChan := make(chan bool)
- go StreamHomeTimeline(client, homeMap, pauseChan)
+ go StreamHomeTimeline(client, homeMap, hc.pauseChan)
for {line, err := rl.Readline()
@@ -76,14 +75,10 @@
//Contextual commands that need to handle their own requirements
switch command {case "pause":
- hc.isPaused = true
- hc.updatePrompt()
- pauseChan <- true
+ hc.togglepause()
continue
case "resume":
- hc.isPaused = false
- hc.updatePrompt()
- pauseChan <- false
+ hc.pause(false)
continue
case "rm":
if !postOK && recentpost != nil {--
⑨