easy-commander
v0.0.3
Published
This is a framework that allows you to create clis quickly and easily, based on commander.
Downloads
10
Readme
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
import {cmdMaker, ICmd} from "easy-commander";
.- Create your <Cmd_Blob> of interface ICmd.
- Using method
cmdMaker.append({
<Cmd_Name>:
<Cmd_Blob>})
to load it. - If you would like to add more, there are 3 ways:
- add more <Cmd_Blob> in the input structure
cmdMaker.append({ a: blob1, b: blob2, ... })
- pipe the method
append
cmdMaker.append({ a: blob1 }).append({ b: blob2 })
- both
- add more <Cmd_Blob> in the input structure
- 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. */ }, ... })