Skip to content

Commit

Permalink
feat: Allow short option key (#586)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikuroXina authored Nov 26, 2022
1 parent e502323 commit 66205ab
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/service/command/meme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ export class Meme implements CommandResponder<typeof SCHEMA> {
return;
}
const sanitizedArgs = sanitizeArgs(commandArgs);
const { flags, options, unparsed } = parse(sanitizedArgs);
const hyphen = (key: string) => (key.length <= 1 ? `-${key}` : `--${key}`);
const { flags, options, unparsed } = parse(sanitizedArgs, {
flags: meme.flagsKeys.map(hyphen),
options: meme.optionsKeys.map(hyphen)
});
const body = unparsed.join(' ');
if (flags['help'] || options['help']) {
await message.reply({
Expand Down

0 comments on commit 66205ab

Please sign in to comment.