cowmand
TypeScript icon, indicating that this package has built-in type declarations

0.6.1 • Public • Published

Cowmand

_🐮 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 module available through the npm registry.

Use npm:

$ npm install cowmmand

Use yarn:

$ yarn add cowmmand

Example Initial

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

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:

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

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 file for more details.

Readme

Keywords

none

Package Sidebar

Install

npm i cowmand

Weekly Downloads

1

Version

0.6.1

License

MIT

Unpacked Size

35.6 kB

Total Files

25

Last publish

Collaborators

  • marconwillian