Skip to content
arg and flag parser for oclif
Branch: master
Clone or download
Latest commit b420f0f Mar 15, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci chore: add node-10 CI target Dec 18, 2018
.github
src
test fix: ignore defaulted flags for exclusivity Mar 15, 2019
.editorconfig
.eslintignore
.eslintrc fix: rename to oclif Feb 13, 2018
.gitattributes
.gitignore
CHANGELOG.md v3.7.3 Mar 15, 2019
LICENSE docs: Add LICENSE Feb 15, 2018
README.md fix: remove greenkeeper badge Oct 13, 2018
appveyor.yml fix: typescript 2.9 (#26) May 31, 2018
example.js
package.json v3.7.3 Mar 15, 2019
tsconfig.json
tslint.json
yarn.lock chore: remove semantic-release Dec 18, 2018

README.md

@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
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.