# nopt-defaults

> Default options for nopt

Latest version **0.0.1** (published 2014-04-07) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install nopt-defaults
pnpm add nopt-defaults
yarn add nopt-defaults
bun add nopt-defaults
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2014-04-07 |
| First published | 2014-04-07 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Brandon Mills |
| Maintainers | btmills |
| Keywords | cli, nopt, default, options |

## Links

- npm: https://www.npmjs.com/package/nopt-defaults
- Repository: https://github.com/btmills/nopt-defaults
- Issues: https://github.com/btmills/nopt-defaults/issues
- npm.io page: https://npm.io/package/nopt-defaults

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

- 0.0.1 (latest) — 2014-04-07

## README

# nopt-defaults

*Default options for [nopt](https://github.com/npm/nopt)*

## Usage

```
npm install nopt nopt-defaults
```

```js
// my-program.js
var nopt = require('nopt');
var noptDefaults = require('nopt-defaults');

var knownOpts = {
    foo: String,
    bloo: ['big', 'medium', 'small'],
    flag: Boolean
};

var defaults = {
    bloo: 'medium',
    flag: true
};

var parsed = noptDefaults(nopt(knownOpts), defaults);
console.log(parsed);
```

Examples:

```bash
$ node my-program.js
{ "bloo": "medium", "flag": true }

$ node my-program.js --bloo big
{ "bloo": "big", "flag": true }

$ node my-program.js --no-flag
{ "bloo": "medium", "flag": false }

$ node my-program.js --flag false
{ "bloo": "medium", "flag": false }

$ node my-program.js --foo Hi
{ "foo": "Hi", "bloo": "medium", "flag": false }
```

## License

Licensed under the [BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause), the full text of which can be read in [LICENSE](LICENSE).

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