# opparse

> Command line argument parser usinng Microsoft Command Line Standard.

Latest version **1.0.7** (published 2022-09-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install opparse
pnpm add opparse
yarn add opparse
bun add opparse
```

## 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 | 1.0.7 |
| Published | 2022-09-12 |
| First published | 2022-09-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Ibrahim Sharaf |
| Maintainers | ibrahimsharaf0 |
| Keywords | Argument, Parser, args |

## Links

- npm: https://www.npmjs.com/package/opparse
- Repository: https://github.com/ibrahim-sharaf/scap
- Homepage: https://github.com/ibrahim-sharaf/scap#readme
- Issues: https://github.com/ibrahim-sharaf/scap/issues
- npm.io page: https://npm.io/package/opparse

## 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

- 1.0.7 (latest) — 2022-09-12
- 1.0.6 — 2022-09-09
- 1.0.5 — 2022-09-08
- 1.0.4 — 2022-09-07
- 1.0.3 — 2022-09-07
- 1.0.2 — 2022-09-07
- 1.0.1 — 2022-09-07

## README

## opparse

opparse is an argument parser that uses Microsoft Command Line Standard. 


### DESCRIPTION

Simple JS implementation of Microsoft command line argument parsing standards
[Command Line Standard](https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-powershell-1.0/ee156811(v=technet.10)?redirectedfrom=MSDN)


### Installation

```
npm install opparse
```

### USAGE


```
$node ./script.js -k:hello -num:1,2,3 -b other
```

```javascript

const parser = require('opparse');

//Getting rid of node path and called script
const args = parser.helper(process.argv)

const result = parser.parse(args, {"k": String, "num": Array, b:Boolean});
```
The first argument is an array of strings to be parsed, the second argument
is an object describing the signature for the command Entries take the form of:

```
name = Type
```
Type can be an String, Number, Boolean or Array.

The result of the parse will be to return an object (hash table)
mapping actual parameters to their values, including the type conversions

for example the result of the above example would be:
```
{
	"k": "hello",
	"num":[1,2,3],
	"b": true,
	 __rest: ["other"]
}

```
\__rest member is just an array holding unclaimed arguments 

the following command line arguments give similar results as the above:
```
$node ./script.js -k: hello -num:1,2,3 -b other
```
```
$node ./script.js -k=hello -num:1,2,3 -b other
```
```
$node ./script.js -k= hello -num:1,2,3 -b other
```
```
$node ./script.js -k hello -num:1,2,3 -b other
```

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