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

d61ea73 · Aug 22, 2023
Oct 19, 2022
Sep 26, 2022
Feb 25, 2022
Feb 25, 2022
Jan 14, 2018
Jan 14, 2018
Nov 22, 2019
Jan 16, 2018
Jan 16, 2018
Dec 11, 2020
Aug 19, 2023
Feb 15, 2018
Aug 22, 2023
Jan 14, 2018
Aug 19, 2023
May 31, 2018
Aug 19, 2023

Repository files navigation

@oclif/parser

This library has been replaced by @oclif/core and is no longer maintained

arg and flag parser for oclif

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