@anycli/parser
TypeScript icon, indicating that this package has built-in type declarations

3.2.6 • Public • Published

@anycli/parser

arg and flag parser for anycli

Version CircleCI Appveyor CI Codecov Greenkeeper Known Vulnerabilities Downloads/week License

CLI flag parser.

Usage:

const CLI = require('cli-flags')

const {flags, args} = CLI.parse({
  flags: {
    'output-file': CLI.flags.string({char: 'o'}),
    force: CLI.flags.boolean({char: 'f'})
  },
  args: [
    {name: 'input', required: true}
  ]
})

if (flags.force) {
  console.log('--force was set')
}

if (flags['output-file']) {
  console.log(`output file is: ${flags['output-file']}`)
}

console.log(`input arg: ${args.input}`)

// $ node example.js -f myinput --output-file=myexample.txt
// --force was set
// output file is: myexample.txt
// input arg: myinput

Dependencies (0)

    Dev Dependencies (18)

    Package Sidebar

    Install

    npm i @anycli/parser

    Weekly Downloads

    15

    Version

    3.2.6

    License

    MIT

    Last publish

    Collaborators

    • anycli-bot
    • rasphilco
    • dickeyxxx