# zc-conf

> config your json config by comand line

Latest version **0.1.1** (published 2017-01-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install zc-conf
pnpm add zc-conf
yarn add zc-conf
bun add zc-conf
```

Provides the command `zc-conf`.

## 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.1.1 |
| Published | 2017-01-07 |
| First published | 2017-01-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | zcong1993 |
| Maintainers | zcong |
| Keywords | conf, json, command |

## Links

- npm: https://www.npmjs.com/package/zc-conf
- Repository: https://github.com/zcong1993/zc-conf
- Homepage: https://github.com/zcong1993/zc-conf#readme
- Issues: https://github.com/zcong1993/zc-conf/issues
- npm.io page: https://npm.io/package/zc-conf

## Dependencies (5)

- [conf](https://npm.io/package/conf.md) ^0.11.2
- [meow](https://npm.io/package/meow.md) ^3.7.0
- [chalk](https://npm.io/package/chalk.md) ^1.1.3
- [update-notifier](https://npm.io/package/update-notifier.md) ^1.0.3
- [babel-preset-env](https://npm.io/package/babel-preset-env.md) ^1.1.5

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.1.1 (latest) — 2017-01-07
- 0.1.0 — 2017-01-07
- 0.0.1 — 2017-01-07

## README

# zc-conf [![Build Status](https://img.shields.io/circleci/project/zcong1993/zc-conf/master.svg?style=flat)](https://circleci.com/gh/zcong1993/zc-conf)

> config your json config by comand line
>
> based on [sindresorhus/conf](https://github.com/sindresorhus/conf)

## Install

```sh
$ npm install zc-conf -g
# or use yarn
$ yarn global add zc-conf
```

## Usage

Now, if we have a test.json like this:

```json
{
    "name": "zcong1993",
    "age": 18
}
```

## show data `$ zc-conf [file] get`

```sh
$ zc-conf test.json get
# we will get
{ name: 'zcong1993', age: 18 }
```

## show val `$ zc-conf [file] get [key]`

```sh
$ zc-conf test.json get name
# we will get
# zcong1993
```

## set value `$ zc-conf [file] set [key] [val]`

> if the file not exists, `zc-conf` will help you create first

```sh
$ zc-conf test.json set language javascript
$ less test.json
# we will find
{
        "name": "zcong1993",
        "age": 18,
        "language": "javascript"
}
```

### set object

```sh
$ zc-conf test.json set user.name zcong1993
# less test.json
{
        "name": "zcong1993",
        "age": 18,
        "language": "javascript",
        "user": {
                "name": "zcong1993"
        }
}
```

### set an exists attribute

```sh
$ zc-conf test.json set langiage php -f # or use --force
```

now we can change the attribute

## add value to an exists key `$ zc-conf [file] add [key] [value]`

> if the key not exists ,this command is same as `set`, but the value is `array`

```sh
$ zc-conf test.json add language php
$ less test.json
{
        "name": "zcong1993",
        "age": 18,
        "language": [
                "javascript",
                "php"
        ]
}
```

## check exists `$ zc-conf [file] has [key]`

```sh
$ zc-conf test.json has name
# true
$ zc-conf test.json has test
# false
```

## delete an attribute `$ zc-conf [file] delete [key]`

```sh
$ zc-conf test.json delete user
{
        "name": "zcong1993",
        "age": 18,
        "language": "javascript"
}
```

## clear a config file `$ zc-conf [file] clear`

```sh
# if we clear test.json
$ zc-conf test.json clear
$ less test.json
# we will get
{}
```

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