Files
ctxGPT/cmd/chat/chat.go
2024-02-25 20:17:48 -07:00

30 lines
535 B
Go

package main
import (
"bufio"
"fmt"
"os"
"strings"
)
func main() {
reader := bufio.NewReader(os.Stdin)
fmt.Println("Go CLI Chat App")
fmt.Println("---------------------")
for {
fmt.Print("You: ")
text, _ := reader.ReadString('\n')
text = strings.TrimSpace(text) // Remove leading and trailing whitespace
// Process the input. For now, we'll just echo it back.
fmt.Printf("App: You said, %s\n", text)
// Check if the user wants to exit.
if text == "exit" {
fmt.Println("Exiting chat...")
break
}
}
}