Bashr
Create stellar CLI applications
About
Bashr is a library for building NodeJS based command line interfaces.
- Route based design
- Command parameters and options/flags
- Middleware architecture
- Lazy-load route modules for fast response time
Example
; ; food.command'hello',; food.runprocess.argv;
$ food helloworld
Overview
Commands
; ; food.command'hello',; food.runprocess.argv;
$ food helloworld
Multiple handlers
; ; ; ; cli.command'hello', handler, handler, handler; cli.runprocess.argv;
$ cli hello012
Parameters
Parameters are described with a :
prefix. You can extract input parameters in command handlers.
Example:
; ; ; cli.command'hello :param', handler; cli.runprocess.argv;
$ cli hello worldworld
Optional Parameters
; ; ; cli.command'hello :[param]', handler; cli.runprocess.argv;
$ cli hello worldworld
Options/Flags
Options and Flags are parsed and configured with yargs-parser.
; ; ; command.option'world', ; cli.runprocess.argv;
$ cli hello --worldtrue
or
$ cli hello -w earthearth
Routes
; ; ; fruit.command'banana',; food.runprocess.argv;
$ food fruit bananaI'm a banana!