notes.dt.in.th

Using yargs in ESM Node.js scripts

import yargs from 'yargs'

yargs(process.argv.slice(2))
  .demandCommand()
  .strict()
  .help()
  .command('$0', 'Do thing', {}, async () => {
    console.log('Doing thing')
  })
  .parse()