# config-cli-helper

> config-cli-helper

Latest version **1.0.3** (published 2023-05-25) · ISC license · 0 weekly downloads

## Install

```sh
npm install config-cli-helper
pnpm add config-cli-helper
yarn add config-cli-helper
bun add config-cli-helper
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2023-05-25 |
| First published | 2023-05-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 10.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | juln |
| Maintainers | juln |
| Keywords | cli, cac, config, helper, configstore |

## Links

- npm: https://www.npmjs.com/package/config-cli-helper
- Repository: https://github.com/z-juln/config-cli-helper
- Homepage: https://github.com/z-juln/config-cli-helper/README.md
- Issues: https://github.com/z-juln/config-cli-helper/issues
- npm.io page: https://npm.io/package/config-cli-helper

## Dependencies (3)

- [cac](https://npm.io/package/cac.md) ^6.7.14
- [tty-table](https://npm.io/package/tty-table.md) ^4.2.1
- [configstore](https://npm.io/package/configstore.md) 5

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2023-05-25
- 1.0.2 — 2023-05-25
- 1.0.1 — 2023-05-25
- 1.0.0 — 2023-05-25

## README

# config-cli-helper

Helper for quickly writing commands such as `npm config ls`、 `npm config get`、 `npm config set` ...

cmd list:
- `you-cli config -h`
- `you-cli config set <key>=<value> [<key>=<value> ...]`
- `you-cli config get [<key> [<key> ...]]`
- `you-cli config del <key> [<key> ...]`
- `you-cli config ls [--json]`
- `you-cli config reset`

## install

`npm i config-cli-helper` or `yarn add config-cli-helper`

## use

```typescript
import cac from 'cac';
import { getConfigStore, getConfigCli, cacHelpWithConfigCli, ParamsDescription } from 'config-cli-helper';

const cliName = 'you-cli';
const defaultConfigStore = {
  config: {
    cwd: './',
  },
};
const paramsDescription: ParamsDescription = [
  { key: 'cwd'; value: string; description: string; },
];
const configStore = getConfigStore(cliName, defaultConfigStore);

// For example, this cmd: `you-cli config ls`
if (process.argv[2] === 'config') {
  const configCli = getConfigCli({
    cliName,
    configStore, // If you want to customize 'configStore', you can pass in this parameter. Otherwise, it will generate a "configStore" for you by default
    paramsDescription,
  });
  configCli.parse(process.argv.slice(1));
  process.exit();
}

console.log('config: ', configStore.get('config')); // { cwd: './' }

// Other cmd. For example, this cmd: `you-cli -h`
const cli = cac(cliName);
cli.help(
  cacHelpWithConfigCli(cliName)
);

```

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