Skip to content
Lloyd Brookes edited this page Jan 17, 2018 · 1 revision

By default, option names in the output are identical to those supplied in the option definition. You can receive option names in the output in camel case, if you prefer.

const commandLineArgs = require('command-line-args')
const optionDefinitions = [
  { name: 'stop-at' },
  { name: 'move-to' }
]
const options = commandLineArgs(optionDefinitions, { camelCase: true })
console.log(options)

This command produces the following output.

$ node example.js --stop-at 5 --move-to left
{ stopAt: '5', moveTo: 'left' }