git-style subcommands #94

tj opened this Issue Oct 10, 2012 · 4 comments

3 participants

tj commented Oct 10, 2012

better than what we have IMO. For example component-create(1) vs create being an in-file commander sub command, and facilitate command help sub-command as well, for example my component-help(1) implementation is:

#!/usr/bin/env node

 * Module dependencies.

var program = require('commander')
  , exec = require('child_process').exec;

// parse argv


// output --help

var cmd = program.args[0]
  ? 'component ' + program.args[0] + ' --help'
  : 'component --help';

exec(cmd, function(err, stdout){
  if (err) throw err;

Any other info about this feature request? Are you thinking about multiple entry-points (separate files), or do you want to keep everything inside same file? (It wasn't clear on the initial comment). Any proposed API for that?

PS: I'm going through the open issues and trying to implement whatever I think that might be useful in the future. I almost started my own options/command parser today but commander have almost everything I want/need. Cheers.

tj commented Nov 6, 2012

separate files is a lot nicer, im not a fan of the sub-command stuff we have right now but I dont want to break backwards compat, this stuff could easily be a separate npm module


Do you have an example of this that works on Windows? I am able to get this and the method you use in bin/component working on OS X and Linux, but both return the following error on Windows:

Error: Command failed: C:\...\bin\sketchplate-template is not recognized as an internal or external command, operable program or batch file

bin/sketchplate source

@tj tj closed this in 21b4169 Nov 17, 2012
tj commented Nov 17, 2012

@hapticdata not sure, component was working on windows at one point, we'll have to figure something out I guess, IMO node should support this sort of thing if it's going to pretend to be windows compatible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment