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

remove subcommand --help output comma when more than one arg #212

Closed
wants to merge 1 commit into from
Closed

remove subcommand --help output comma when more than one arg #212

wants to merge 1 commit into from

Conversation

wyntau
Copy link

@wyntau wyntau commented Apr 13, 2014

supose I have defined a program app below

var program = require('commander');

program
    .version('0.0.1');

program
    .command('exec <arg1> [arg2]')
    .description('exec example')
    .action(function(arg1, arg2, options){
        console.log('called exec');
    });

program.parse(process.argv);

Then when I get the exec help info via app exec --help, it will output

Usage: exec [options] <arg1>,[arg2]

  Options:

    -h, --help  output usage information

But the right output should be

Usage: exec [options] <arg1> [arg2]

  Options:

    -h, --help  output usage information

So, I find the problem is that the args is an array, when its length is larger than 1, it will join with ,, what I do is join the array with space :)

supose I have defined a program `app` below
```js
var program = require('commander');

program
    .version('0.0.1');

program
    .command('exec <arg1> [arg2]')
    .description('exec example')
    .action(function(arg1, arg2, options){
        console.log('called exec');
    });

program.parse(process.argv);
```

Then when I get the exec help info via `app exec --help`, it will output 
```bash
Usage: exec [options] <arg1>,[arg2]

  Options:

    -h, --help  output usage information
```

But the right output should be
```js
Usage: exec [options] <arg1> [arg2]

  Options:

    -h, --help  output usage information
```

So, I find the problem is that the `args` is an array, when its length is larger than 1, it will join with `,`, what I do is join the array with space :)
@dbushong
Copy link
Contributor

This is a dup of #186

@wyntau
Copy link
Author

wyntau commented Apr 23, 2014

@dbushong great, your code is more buautiful than mine 👍
So i closed the PR, please let me know when your is merged, thanks~

@wyntau wyntau closed this Apr 23, 2014
@Mithgol
Copy link
Contributor

Mithgol commented May 2, 2014

@jeremial

You should just hit the subscribe button for that PR and then GitHub will let you know when it's merged.

@wyntau
Copy link
Author

wyntau commented May 2, 2014

@Mithgol thanks very much!! I didn't even know the subscribe button until you told me. Thank you very much 👍

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

Successfully merging this pull request may close these issues.

3 participants