Package Exports
- cmd
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 (cmd) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
cmd
Composable command line application library
NOTE: This library is unstable and very much in a pre-alpha state.
Install
npm install cmd --saveUsage
var cli = require('cmd')
var command = require('cmd-command')
var flag = require('cmd-flag')
var alias = require('cmd-alias')
var handler = require('cmd-handler')
var login = command(
alias('login', 'l'),
handler(function (context) {
// Do some login logic
// context.data
// context.flags
// context.options
})
)
var tokenFlag = flag(
alias('-t', '--token'),
handler(function (token, context) {
// Do some token logic
// token is input from argv
// context.data
// context.flags
// context.options
})
)
var run = cli(
login(/* pass in options here */),
tokenFlag(/* pass in options here */)
)
run(process.argv.slice(2))