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

By default, values are collected "greedily" by options defined with multiple: true. This feature is what you need when passing glob expressions, such as --files *.js.

Example

const commandLineArgs = require('command-line-args')
const optionDefinitions = [
  { name: 'files', multiple: true }
]
const options = commandLineArgs(optionDefinitions)
console.log(options)

Example usage including a glob expression.

$ node example.js --files *
{ files:
   [ 'LICENSE',
     'README.md',
     'doc',
     'index.js',
     'lib',
     'node_modules',
     'package.json',
     'test' ] }