Add raw command shorthand

This commit is contained in:
Ken-Håvard Lieng 2017-06-02 22:24:03 +02:00
parent 6d55ce8a2d
commit e5c5938414
3 changed files with 24 additions and 21 deletions

File diff suppressed because one or more lines are too long

View File

@ -183,7 +183,10 @@ export default createCommandMiddleware(COMMAND, {
} }
}, },
[notFoundHandler](_, command) { [notFoundHandler](ctx, command, ...params) {
if (command === command.toUpperCase()) {
return this.raw(ctx, command, ...params);
}
return error(`=> /${command}: No such command`); return error(`=> /${command}: No such command`);
} }
}); });

View File

@ -38,7 +38,7 @@ export default function createCommandMiddleware(type, handlers) {
process(ctx, handlers[command](ctx, ...params)); process(ctx, handlers[command](ctx, ...params));
} else if (notFoundHandler in handlers) { } else if (notFoundHandler in handlers) {
const ctx = createContext(store, action); const ctx = createContext(store, action);
process(ctx, handlers[notFoundHandler](ctx, command)); process(ctx, handlers[notFoundHandler](ctx, command, ...params));
} }
} }