Crocess
Make your command-line programs be easily called by externals.
Links
Requirements
- Node.js >= 6.0.0
Installation
$ npm install crocess
Quick Start
Create an application instance and return data to console:
var Application = Application; ;
You will see this on console:
Hello world!
>>>>>BEGIN_RESULT>>>>>{"foo":"bar"}
You can also return a Promise.
; // or using 'async/await'. ; // => >>>>>BEGIN_RESULT>>>>>{"foo":"bar"}
Get Parameters
You can pass the parameters as a json formatted string with the --parameters
argument.
node example.js --parameters='{"name":"World"}'
Example:
; // => >>>>>BEGIN_RESULT>>>>>Hello World
The
parameters
property will be empty when the--parameters
argument not given.
Using Suite
An example suite class:
var Application = Application;var BaseSuite = Suite; /** * Start handle the suite. */ { console; return 'foobar'; }
Now, boot the suite:
;
You will see this on console:
Hello suite!
>>>>>BEGIN_RESULT>>>>>foobar
Another way to boot suites:
;
If you need to passing something to the suite, a very straightforward way is override the constructor:
{ super; thisfoo = foo; }