22 lines
716 B
JavaScript
22 lines
716 B
JavaScript
import { Parser, Command, OptionType } from '../build/esm/index.js';
|
|
|
|
const command = new Command({
|
|
name: 'create',
|
|
options: [{
|
|
name: 'registration-code',
|
|
aliases: ['code'],
|
|
type: OptionType.SUB_COMMAND,
|
|
options: [{
|
|
name: 'amount',
|
|
flag: true,
|
|
type: OptionType.INTEGER,
|
|
defaultValue: 1,
|
|
valueOptional: true
|
|
}]
|
|
}]
|
|
});
|
|
const parser = new Parser({ commands: [command], prefix: '', debug: true });
|
|
parser.on('debug', console.log)
|
|
console.log(await parser.parseMessage('create code -a 1'));
|
|
console.log(await parser.parseMessage('create code --help'));
|
|
console.log(await parser.parseMessage('create --help')); |