Skip to content

v2.0.0

Choose a tag to compare

@webdiscus webdiscus released this 08 Jul 19:42
· 6 commits to master since this release
a1d5708

⚠️ BREAKING CHANGES

Redesigned structure of return object with parsed elements
Example: cli.js --verbose file.txt -- one two

Old v1.x
Returns:

{
  verbose: true,
  _: ['file.txt', 'one', 'two'],
}

New v2.x
Returns:

{
  args: {},                 // named positional arguments
  flags: { verbose: true }, // parsed flags
  _: ['file.txt'],          // arguments before `--`
  _tail: ['one', 'two'],    // arguments after `--`
}

✅ Features

  • Added args option for named positional arguments
  • Added support for variadic arguments (e.g. ...files) to collect last arguments into array
  • Added boolean option to treat flags as booleans without consuming values
  • Return property _ now contains only positional arguments before --
  • Added return property _tail to capture all arguments after --