diff options
author | Hubert Hirtz <hubert@hirtz.pm> | 2021-02-18 17:13:16 +0100 |
---|---|---|
committer | Hubert Hirtz <hubert@hirtz.pm> | 2021-02-18 17:25:31 +0100 |
commit | fc101c7f0aa0323ef97fd55db6534aa65f4831af (patch) | |
tree | 54f62f02f18e773103a9291a032008c198b50b6b /commands.go | |
parent | Recognize beginning of commands (diff) |
Add the QUIT command
Diffstat (limited to 'commands.go')
-rw-r--r-- | commands.go | 16 |
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 |