Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git-style subcommands #94

Closed
tj opened this issue Oct 10, 2012 · 4 comments
Closed

git-style subcommands #94

tj opened this issue Oct 10, 2012 · 4 comments

Comments

@tj
Copy link
Owner

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

program.parse(process.argv);

// output --help

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

exec(cmd, function(err, stdout){
  if (err) throw err;
  process.stdout.write(stdout);
});
@millermedeiros
Copy link

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
Copy link
Owner Author

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

@hapticdata
Copy link

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 as completed in 21b4169 Nov 17, 2012
@tj
Copy link
Owner Author

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants