yargs-dashed

yargs + dashed arguments as in "head -10"

Usage no npm install needed!

<script type="module">
  import yargsDashed from 'https://cdn.skypack.dev/yargs-dashed';
</script>

README

yargs-dashed Build Status Dependency Status DevDependency Status

npm

Wrapper around yargs that allows passing options in the dashed style as in head -10 file.txt (non-standard).

API

In addition to the yargs':

.dashed(name)

Registers option name as a dashed option.

The dashed option is the one that satisfies the following constraints:

  • it comes first in the list;
  • it starts with a dash;
  • other than that, it consists solely of digits and uppercase.

Such options are rewritten in a conforming way (head -1 file.txt -> head --depth 1 file.txt).

Note that only one such option can be recognized and it must be the first.

Install

npm install yargs-dashed

License

MIT