Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

git-style subcommands #94

Closed
tj opened this Issue · 4 comments

3 participants

@tj
Owner
tj commented

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

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
Owner
tj commented

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

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
@tj
Owner
tj commented

@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
Something went wrong with that request. Please try again.