# cowmand

> Fast helper to create a cli

Latest version **0.6.2** (published 2024-05-18) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 35/100 (D)** — status: abandoned.

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

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.6.2 |
| Published | 2024-05-18 |
| First published | 2022-01-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 4 |
| Unpacked size | 112.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Marcon Willian |
| Maintainers | marconwillian |

## Links

- npm: https://www.npmjs.com/package/cowmand
- Repository: https://github.com/MarconNeves/Cowmand
- Homepage: https://github.com/MarconNeves/Cowmand#readme
- Issues: https://github.com/MarconNeves/Cowmand/issues
- npm.io page: https://npm.io/package/cowmand

## Dependencies (4)

- [ora](https://npm.io/package/ora.md) 5.4.1
- [chalk](https://npm.io/package/chalk.md) 4.1.2
- [debug](https://npm.io/package/debug.md) ^4.3.3
- [jsonfile](https://npm.io/package/jsonfile.md) ^6.1.0

## Recent versions

- 0.6.2 (latest) — 2024-05-18
- 0.7.0-beta.4 (beta) — 2024-05-20
- 0.7.0-beta.3 — 2024-05-20
- 0.7.0-beta.2 — 2024-05-19
- 0.7.0-beta.1 — 2024-05-18
- 0.6.1 — 2024-02-11
- 0.6.0 — 2022-12-02
- 0.5.3 — 2022-02-15
- 0.5.2 — 2022-01-31
- 0.5.1 — 2022-01-30
- 0.4.23 — 2022-01-27
- 0.4.20 — 2022-01-27
- 0.4.19 — 2022-01-27
- 0.4.18 — 2022-01-27
- 0.4.17 — 2022-01-27
- … 31 more at https://npm.io/package/cowmand/versions

## README

![Cowmand][cowmand-logo]

# _🐮 Cowmand - \_BETA_

## Introduction

This lib get beginning of express to create a cli. It's a simple way to create a cli.

## Installation

This is a [Node.js](https://nodejs.org/en/) module available through the
[npm registry][cowmand-npm].

Use npm:

```
$ npm install cowmand
```

Use yarn:

```
$ yarn add cowmand
```

## Example Initial

Using middleware in global, but with rules to notIn `["login"]`.

```typescript
import Cowmand from 'cowmand';
import { GuardLogin } from './guardLogin';
import { Login } from './login';

const program = Cowmand();

program.use({ notIn: ['login'] }, GuardLogin);

program.command(['login'], Login);

program.command(['me'], (context, terminal) => {
  terminal.log(`Hello, ${context.session.user?.name}!`).end();
});

program.start();
```

Using middleware before command handle:

```typescript
import Cowmand from 'cowmand';
import { GuardLogin } from './guardLogin';
import { Login } from './login';

const program = Cowmand();

program.command(['login'], Login);

program.command(['me'], GuardLogin, (context, terminal) => {
  terminal.log(`Hello, ${context.session.user?.name}!`).end();
});

program.start();
```

## Docs

**Terminal** [Docs](/docs/Terminal.md)

## New Features

- [x] Commander Routes - Similar with Router of express, for use commands in other file.
- [x] Validate errors Layers
- [ ] Terminal - Add table console
- [x] Terminal - Add question on terminal
- [x] Terminal - Add option to hide a password

---

This project is under the MIT license. See the [LICENSE][license-link] file for more details.

<!-- Markdown link & img's -->

[license-link]: /LICENSE
[cowmand-logo]: https://i.imgur.com/dWPzX9W.png
[cowmand-npm]: https://www.npmjs.com/package/cowmand

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