shithub: hell

Download patch

ref: a050f0833c38fda7085d8884a0fddc6cf1486763
parent: 864489632f86f20b956dd148ab7f4aeac2bb0e3a
author: penny <penny@limitedideas.org>
date: Fri Oct 3 13:57:54 EDT 2025

include the file with the new code

--- /dev/null
+++ b/prompt.go
@@ -1,0 +1,66 @@
+package main
+
+import (
+	"strings"
+	"fmt"
+	"context"
+
+	"github.com/ergochat/readline"
+)
+
+// Returns text to add to the status bar
+type PromptItem interface {
+	Update() (string, bool, error)
+}
+
+// Renders a status bar with a prompt and PromptItems
+type PromptBar struct {
+	prompt string
+	items  []PromptItem
+	rl     *readline.Instance
+}
+
+// Render the prompt and update the readline prompt
+func (pb *PromptBar) UpdatePrompt() {
+	var sb strings.Builder
+	
+	for item := range pb.items {
+		status, print, err := pb.items[item].Update()
+		if err != nil {
+			fmt.Printf("Error updating status item: %s\n", err)
+		}
+		if print {
+			sb.WriteString(status)
+			sb.WriteString(" ")
+		}
+	}
+	sb.WriteString(pb.prompt)
+	pb.rl.SetPrompt(sb.String())
+}
+
+type NotificationCounter struct {
+	*Hellclient
+}
+
+func (nc *NotificationCounter) Update() (string, bool, error) {
+	unread, err := nc.client.GetUnreadNotifications(context.Background(), nil, nil, 0)
+	if err != nil {
+		return "", false, err
+	}
+	if unread.Count == 0 {
+		return "", false, nil
+	}
+	return fmt.Sprintf("ur:%d", unread.Count), true, nil
+}
+
+// MultiLineIndicator shows when multi-line input mode is active.
+type MultiLineIndicator struct {
+	*Hellclient
+}
+
+func (ml *MultiLineIndicator) Update() (string, bool, error) {
+	if ml.multiLineMode {
+		return "MULTILINE", true, nil
+	}
+	return "", false, nil
+}
--