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

0.0.3 • Public • Published

Easy Commander

easy-commander is a framework that allows you to create clis quickly and easily, based on commander.

Installation

npm i --SAVE easy-commander or yarn add easy-commander

Quick Start

  1. import {cmdMaker, ICmd} from "easy-commander";.
  2. Create your <Cmd_Blob> of interface ICmd.
  3. Using method cmdMaker.append({<Cmd_Name> : <Cmd_Blob> }) to load it.
  4. If you would like to add more, there are 3 ways:
    1. add more <Cmd_Blob> in the input structure cmdMaker.append({ a: blob1, b: blob2, ... })
    2. pipe the method append cmdMaker.append({ a: blob1 }).append({ b: blob2 })
    3. both
  5. Finally, call cmdMaker.start()

Advanced Usages

  • get commander

    cmdMaker.commander

  • to apply custom setting of command

    cmdMaker.custom(cmd => { ... })

  • set version when start

    cmdMaker.start({ version: "0.1.0", ... })

  • set fallback method when start

    cmdMaker.start({ cbFallback: ()=> { /** do sth. */ }, ... })

Usage Examples

Readme

Keywords

Package Sidebar

Install

npm i easy-commander

Weekly Downloads

0

Version

0.0.3

License

MIT

Unpacked Size

6.3 kB

Total Files

5

Last publish

Collaborators

  • kinghand