summaryrefslogtreecommitdiff
path: root/commands.go
diff options
context:
space:
mode:
authorHubert Hirtz <hubert@hirtz.pm>2021-02-18 17:13:16 +0100
committerHubert Hirtz <hubert@hirtz.pm>2021-02-18 17:25:31 +0100
commitfc101c7f0aa0323ef97fd55db6534aa65f4831af (patch)
tree54f62f02f18e773103a9291a032008c198b50b6b /commands.go
parentRecognize beginning of commands (diff)
Add the QUIT command
Diffstat (limited to 'commands.go')
-rw-r--r--commands.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/commands.go b/commands.go
index 993698d..b1cc9dd 100644
--- a/commands.go
+++ b/commands.go
@@ -64,6 +64,12 @@ func init() {
Desc: "part a channel",
Handle: commandDoPart,
},
+ "QUIT": {
+ AllowHome: true,
+ Usage: "[reason]",
+ Desc: "quit senpai",
+ Handle: commandDoQuit,
+ },
"QUOTE": {
MinArgs: 1,
AllowHome: true,
@@ -248,6 +254,16 @@ func commandDoPart(app *App, buffer string, args []string) (err error) {
return
}
+func commandDoQuit(app *App, buffer string, args []string) (err error) {
+ reason := ""
+ if 0 < len(args) {
+ reason = args[0]
+ }
+ app.s.Quit(reason)
+ app.win.Exit()
+ return
+}
+
func commandDoQuote(app *App, buffer string, args []string) (err error) {
app.s.SendRaw(args[0])
return