const { inspect } = require('node:util'); const { Parser, Command, OptionType } = require('../build'); const command = new Command({name: 'create', options:[{name: 'registration-code', aliases: ['code'], type: OptionType.SUB_COMMAND}]}) const parser = new Parser({commands: [command], prefix: ''}) const debug = (a) => console.log(inspect(a)); const handle = async (data) => { const raw = data.toString('utf-8'); let words = raw.split(' ').map(word => word.trim()); words = words.filter(word => word.length); if (!words.length) return; debug((words)); const result = await parser.parseMessage(words.join(' ')); debug(result) } process.stdin.on('data', handle)