/mode: use active buffer if omitted

This commit is contained in:
Drew DeVault 2021-05-27 09:37:09 -04:00 committed by Simon Ser
parent a0c85c3372
commit e2e2f7a8fc

View file

@ -93,6 +93,14 @@ export default {
usage: "<target> <modes> [mode args...]", usage: "<target> <modes> [mode args...]",
description: "Change channel or user mode", description: "Change channel or user mode",
execute: (app, args) => { execute: (app, args) => {
var target = args[0];
if (target.startsWith("+") || target.startsWith("-")) {
var activeBuffer = app.state.buffers.get(app.state.activeBuffer);
if (!activeBuffer || !app.isChannel(activeBuffer.name)) {
throw new Error("Not in a channel");
}
args = [activeBuffer.name, ...args];
}
getActiveClient(app).send({ command: "MODE", params: args }); getActiveClient(app).send({ command: "MODE", params: args });
}, },
}, },