args-and-flags

parse and validate args and flags for commandline tools

Usage no npm install needed!

<script type="module">
  import argsAndFlags from 'https://cdn.skypack.dev/args-and-flags';
</script>

README

args-and-flags

An argument parser based on minimist that offers named arguments, flags, validation, and default or required values.

npm standard conduct

Install

npm install --save args-and-flags

Node v8 and higher is required

Usage

import ArgsAndFlags from 'args-and-flags'

const options = {
  args: [
    {
      name: 'hello',
      type: 'string',
      help: 'an argument for saying hello'
    }
  ],
  flags: [
    {
      name: 'message',
      alias: 'm',
      type: 'boolean',
      help: 'a boolean argument'
    }
  ]
}

const parser = new ArgsAndFlags(options)
const { args, flags } = parser.parse(['hi', '-m'])

Documentation

Examples

Contributing

Contributions are welcome! Please read the contributing guidelines first.

Conduct

Help keep this project open and inclusive. Read and follow our Code of Conduct.

Change log

Read about the changes to this project in CHANGELOG.md. The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

Contact

License

ISC