# args-and-flags

> parse and validate args and flags for commandline tools

Latest version **3.0.3** (published 2023-02-19) · ISC license · 0 weekly downloads

## Install

```sh
npm install args-and-flags
pnpm add args-and-flags
yarn add args-and-flags
bun add args-and-flags
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.3 |
| Published | 2023-02-19 |
| First published | 2018-09-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 26.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | sethvincent |
| Maintainers | sethvincent |
| Keywords | minimist, cli, args, flags |

## Links

- npm: https://www.npmjs.com/package/args-and-flags
- Repository: https://github.com/sethvincent/args-and-flags
- Homepage: https://github.com/sethvincent/args-and-flags#readme
- Issues: https://github.com/sethvincent/args-and-flags/issues
- npm.io page: https://npm.io/package/args-and-flags

## Dependencies (4)

- [mri](https://npm.io/package/mri.md) ^1.2.0
- [is-regexp](https://npm.io/package/is-regexp.md) ^3.1.0
- [wrap-ansi](https://npm.io/package/wrap-ansi.md) ^8.1.0
- [is-boolean-object](https://npm.io/package/is-boolean-object.md) ^1.1.2

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 3.0.3 (latest) — 2023-02-19
- 3.0.2 — 2022-05-13
- 3.0.1 — 2021-11-20
- 3.0.0 — 2021-11-20
- 2.3.0 — 2019-11-02
- 2.2.2 — 2019-11-02
- 2.2.1 — 2019-11-02
- 2.2.0 — 2019-08-12
- 2.1.0 — 2018-12-26
- 2.0.0 — 2018-10-28
- 1.1.0 — 2018-10-10
- 1.0.0 — 2018-09-16

## README

# args-and-flags

An argument parser based on [minimist](https://npmjs.com/minimist) that offers named arguments, flags, validation, and default or required values.

[![npm][npm-image]][npm-url]
[![standard][standard-image]][standard-url]
[![conduct][conduct]][conduct-url]

[npm-image]: https://img.shields.io/npm/v/args-and-flags.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/args-and-flags
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[standard-url]: http://npm.im/standard
[conduct]: https://img.shields.io/badge/code%20of%20conduct-contributor%20covenant-green.svg?style=flat-square
[conduct-url]: CODE_OF_CONDUCT.md

## Install

```sh
npm install --save args-and-flags
```

> Node v8 and higher is required

## Usage

```js
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

- [API](docs/api.md)
- [Tests](tests/)

### Examples

- [Basic example](examples/basic-usage.js)

## Contributing

Contributions are welcome! Please read the [contributing guidelines](CONTRIBUTING.md) first.

## Conduct

Help keep this project open and inclusive. Read and follow our [Code of Conduct](CODE_OF_CONDUCT.md).

## Change log

Read about the changes to this project in [CHANGELOG.md](CHANGELOG.md). The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## Contact

- **issues** – Please open issues in the [issues queue](https://github.com/sethvincent/args-and-flags/issues)

## License

[ISC](LICENSE.md)

---
_Source: https://npm.io/package/args-and-flags · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
