# @keg-hub/args-parse

> Parse command line arguments

Latest version **10.0.1** (published 2023-07-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @keg-hub/args-parse
pnpm add @keg-hub/args-parse
yarn add @keg-hub/args-parse
bun add @keg-hub/args-parse
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 10.0.1 |
| Published | 2023-07-29 |
| First published | 2020-09-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 52.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | keg-hub |
| Maintainers | lktipton |
| Keywords | arguments, parse, cli |

## Links

- npm: https://www.npmjs.com/package/@keg-hub/args-parse
- Repository: https://github.com/keg-hub/keg-cli
- Homepage: https://github.com/keg-hub/keg-cli#readme
- Issues: https://github.com/keg-hub/keg-cli/issues
- npm.io page: https://npm.io/package/@keg-hub/args-parse

## Dependencies (2)

- [app-root-path](https://npm.io/package/app-root-path.md) 3.0.0
- [@keg-hub/jsutils](https://npm.io/package/@keg-hub/jsutils.md) >=9.6.1

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 10.0.1 (latest) — 2023-07-29
- 10.0.0 — 2023-03-14
- 9.0.0 — 2022-07-17
- 8.0.1 — 2022-06-05
- 8.0.0 — 2022-03-10
- 7.1.0 — 2022-01-05
- 7.0.0 — 2021-12-17
- 6.3.2 — 2021-10-29
- 6.3.1 — 2021-05-26
- 6.3.0 — 2021-05-26
- 6.2.3 — 2021-03-17
- 6.2.2 — 2021-02-12
- 6.2.1 — 2020-12-17
- 6.1.0 — 2020-10-16
- 0.0.1 — 2020-09-03

## README

# argsParse
Parse command line arguments

## Setup

### Install It

* With **yarn**
```bash
yarn add @keg-hub/args-parse
```

* With **npm**
```bash
npm install @keg-hub/args-parse
```

### Use It
See test [examples](https://github.com/keg-hub/keg-cli/blob/main/repos/args-parse/src/__tests__/argsParse.js)

```js
;(() => {

  const { argsParse } = require('@keg-hub/args-parse')
  const task = {
    options: {
      // Define required
      doo: {
        description: "dew the doo",
        require: true,
      },
      // Define defaults
      foo: {
        description: 'I am foo bar',
        default: 'bar'
      },
      baz: {
      // Define alias
        alias: [ 'zoo' ],
        description: 'The baz with bas',
      },
    }
  }
  
  const parsed = await argsParse({
    task,
    args: [ 'doo=f', '--zoo', 'bas', ],
  })
  
  expect(parsed.doo).toBe(false)
  expect(parsed.foo).toBe('bar')
  expect(parsed.baz).toBe('bas')

})()

```

## Custom Config
* Use the `PARSE_CONFIG_PATH` environment vairable to overwrite the path to the parse config
  * Path should be relative to the applications root directory
* See default [config](https://github.com/keg-hub/keg-cli/blob/main/repos/args-parse/configs/parse.config.js)
* Custom Configs should match the keys within the default config
  * `bools` && `environment`

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