commit 28fb1bc
delthas
·
2023-11-15 13:50:56 +0000 UTC
parent edf0d17
Prompt for confirmation for messages that look like commands Fixes: https://todo.sr.ht/~taiite/senpai/129
1 files changed,
+4,
-0
+4,
-0
1@@ -940,6 +940,10 @@ func (app *App) handleInput(buffer, content string) error {
2
3 cmdName, rawArgs, isCommand := parseCommand(content)
4 if !isCommand {
5+ if _, _, command := parseCommand(strings.TrimSpace(content)); !confirmed && command {
6+ // " /FOO BAR"
7+ return fmt.Errorf("this message looks like a command; remove the spaces at the start, or press enter again to send the message as is")
8+ }
9 return noCommand(app, rawArgs)
10 }
11 if cmdName == "" {