ubermanu / as-command

A command line arguments parser for AssemblyScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

as-command

A command line arguments parser for AssemblyScript.

Installation

npm install as-command --save

Usage

import command from 'as-command'

const program = command
  .name('pizza-cli')
  .version('4.1.79')
  .description('Order your pizza')
  .option('-c, --cheese', 'Add the specified type of cheese [marble]', [
    'marble',
  ])
  .option('-p, --peppers', 'Add peppers')
  .option('-t, --tomatoes', 'Add tomatoes')
  .action((args) => {
    console.log(`Preparing pizza with:`)

    if (args.has('cheese')) {
      console.log(`+ cheese: ${args.get('cheese').join(', ')}`)
    }
    if (args.has('peppers')) {
      console.log('+ peppers')
    }
    if (args.has('tomatoes')) {
      console.log('+ tomatoes')
    }
  })

program.parse(process.argv)

About

A command line arguments parser for AssemblyScript

License:MIT License


Languages

Language:TypeScript 97.2%Language:JavaScript 2.8%