Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 75 lines (53 sloc) 1.774 kb
#!/usr/bin/env node
/**
* Module dependencies.
*/
var program = require('commander')
, utils = require('../lib/utils')
, spawn = require('win-fork')
, path = require('path')
, fs = require('fs')
, join = path.join
, exists = fs.existsSync;
// usage
program
.version(require('../package').version)
.usage('<command> [options]');
// sub-command help
program.on('--help', function(){
console.log(' Commands:');
console.log();
console.log(' install [name ...] install one or more components');
console.log(' create [dir] create a component skeleton');
console.log(' search [query] search with the given query');
console.log(' convert <file ...> convert html files to js modules');
console.log(' info <name> [prop] output json component information');
console.log(' changes <name> output changelog contents');
console.log(' docs <name> output readme contents');
console.log(' wiki open the components list wiki page');
console.log(' build build the component');
console.log(' ls list installed components');
console.log();
process.exit();
});
// parse argv
program.parse(process.argv);
// args void of cmd
var args = process.argv.slice(3);
// command
var cmd = program.args[0];
// alias "install" as "add"
if ('add' == cmd) cmd = 'install';
// display help
if (!cmd) {
process.stdout.write(program.helpInformation());
program.emit('--help');
process.exit();
}
// executable
var bin = 'component-' + cmd;
// local
var local = join(__dirname, bin);
if (exists(local)) bin = local;
// spawn
var proc = spawn(bin, args, { stdio: 'inherit', customFds: [0, 1, 2] });
Jump to Line
Something went wrong with that request. Please try again.