Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

oclif/parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

3e5dd46 · Oct 17, 2018
Sep 14, 2018
May 4, 2018
Oct 17, 2018
Oct 17, 2018
Jan 14, 2018
Jan 14, 2018
Feb 13, 2018
Jan 16, 2018
Jan 16, 2018
Oct 17, 2018
Feb 15, 2018
Oct 13, 2018
May 31, 2018
Jan 14, 2018
Oct 17, 2018
May 31, 2018
Feb 13, 2018
Oct 13, 2018

Repository files navigation

@oclif/parser

arg and flag parser for oclif

Version CircleCI Appveyor CI Codecov 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