nodejs command line tool
$ npm install lepi -D
It register command in system
name
: string
- command name
handler
: function( args: Array, done: function)
- function to process command
args
- list of command parameters, which was separate by spaces, first item is command namedone
- function which has to be called once command processing is completed, if function is called with argumenttrue
, then application will be closed
It print text into console
text
: string
- text to print
color
: [optional] string
- one of based colors: red
, blue
, green
, yellow
, magenta
, ...
It print nice title into console
text
: string
- text to print
color
: [optional] string
- one of based colors: red
, blue
, green
, yellow
, magenta
, ...
Here is a simple example:
const lepi = require('../index')
lepi.title('Test', 'magenta')
lepi.command('test',(args, done)=>{
lepi.log('running http request...')
setTimeout(()=>{
lepi.log('completed','green')
done()
}, 2000)
})
$ lepi -c ./lepiconfig.js
MIT