Skip to content

Command manager

Viktor Likin edited this page Mar 18, 2020 · 8 revisions
(async function () {
  const {runCommand} = require('../src/cli')
  await runCommand(
    [
      {
        name: 'print',
        title: 'Prints values',
        handler: async ({request, injection: {console, DateFactory}}) => {
          console.log(`I am printing you - ${request.values.join(' --> ')} -  now at ${new DateFactory()}`)

          return true
        }
      },
    ],
    {
      DateFactory: Date
    },
    process.argv.slice(2)
  )
})()
Clone this wiki locally