# c2h6o

> CLI tools for node developing or console debugging

Latest version **4.0.5** (published 2023-01-11) · ISC license · 0 weekly downloads

## Install

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

Provides the command `c2o`.

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.5 |
| Published | 2023-01-11 |
| First published | 2019-04-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 48.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | chengxiao |
| Maintainers | chengxiao, zhaoning, ninazhang |

## Links

- npm: https://www.npmjs.com/package/c2h6o
- npm.io page: https://npm.io/package/c2h6o

## Dependencies (2)

- [ch4o](https://npm.io/package/ch4o.md) ^2.2.2
- [tslib](https://npm.io/package/tslib.md) ^2.4.0

## Recent versions

- 4.0.5 (latest) — 2023-01-11
- 4.0.4 — 2022-12-22
- 4.0.3 — 2022-11-04
- 4.0.2 — 2022-10-11
- 4.0.1 — 2022-09-26
- 4.0.0 — 2022-09-26
- 3.1.1 — 2022-09-07
- 3.1.0 — 2022-09-07
- 3.0.3 — 2022-05-26
- 3.0.2 — 2022-05-26
- 3.0.1 — 2022-04-14
- 3.0.0 — 2021-11-30
- 2.2.4 — 2021-06-23
- 2.2.3 — 2021-06-23
- 2.2.2 — 2021-06-23
- … 18 more at https://npm.io/package/c2h6o/versions

## README

# CLI tools for node developing or console debugging

In current version there are several components inside this package:
## `clipp`: A cli param parser

`Clip` is a class, you can use it to define arguments, and then get theirs value by parsing a string which formatted like shell command syntax.
Usage:

```ts
import { co, Clip } from 'c2h6o';
import { format } from './extractor';

const clip = new Clip([
    {
        'names': ['config', 'c'],
        'description': 'Specify custom config file',
        'optional': true,
    },
    {
        'names': ['file', 'f'],
        'description': 'Input file',
        'optional': false,
    },
    {
        'names': ['pattern', 'p'],
        'optional': true,
        
    },
    {
        'names': ['output', 'o'],
        'description': 'Output file',
        'optional': true,
        // 'default': ''
    }
]).parse(process.argv);

// Check if required entry provided and comform with `validator`'s rule
// this action can be omitted
clip.audit();

console.log(clip.getValue('config'));

```

## `co`: Tools to colorize output texts

`co` is an object like `console`.

the common `log` method takes values with `colorize gramma` to paint the output string.

It now ONLY suppts 256color shell or web-developer-tools console evironments.

Colorizing gramma:

```js
co.log('Color #[f00]red#[] or #[00f]blue#[] string.');
```

`co` is also a function which returns the formatted string instead of outputing
```js
const costr = co('#[f00]A red string');
```

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