Package Exports
- simple-cli-parser
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (simple-cli-parser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
simple-cli-parser
A simple parser for a spawning child_process, with promises.
Install
npm install simple-cli-parser --saveUsage
To see the result of ls -la.
'use strict';
const cli = require('simple-cli-parser');
let ls = new cli([ 'ls', '-la', __dirname ])
.then(res => { console.log('Success!', res); })
.catch(err => { console.log('Failed!'); });To stream the result of a curl download (to check current percentage).
'use strict';
const cli = require('simple-cli-parser'),
currentPercentage = data => { // Optional function for checking status
let percent = parseFloat(data, 10);
if (!isNaN(percent) && percent > 0){ console.log(percent + '%'); }
};
let download = new cli([ 'curl', '-O', 'http://speedtest.ftp.otenet.gr/files/test10Mb.db', '-#' ], currentPercentage)
.then(res => { console.log('Success!', res); })
.catch(err => { console.log('Failed!'); });To pass options (https://nodejs.org/api/child_process.html)
'use strict';
const cli = require('simple-cli-parser');
let ls = new cli([ 'git', 'branch', '-a' ], null, { cwd: '/repos/app' })
.then(res => { console.log('Success!', res); })
.catch(err => { console.log('Failed!'); });