Skip to content

Commit

Permalink
Adjust yo generator --help usage output
Browse files Browse the repository at this point in the history
Used to still say `yeoman init` by default.
  • Loading branch information
passy committed Sep 7, 2013
1 parent 5ddffb2 commit 4c21283
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
11 changes: 3 additions & 8 deletions lib/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,17 +461,12 @@ Base.prototype.help = function help() {
*/

Base.prototype.usage = function usage() {
var args = this._arguments.map(function (arg) {
return arg.config.banner;
}).join(' ');

var options = this._options.length ? '[options]' : '',
name = (this.namespace === 'yeoman:app' || !this.namespace) ? '' : this.namespace + ' ',
cmd = 'init';
var options = this._options.length ? '[options]' : '';
var name = this.generatorName ? ' ' + this.generatorName : '';

name = name.replace(/^yeoman:/, '');

var out = 'yeoman ' + cmd + ' ' + name + args + ' ' + options;
var out = 'yo' + name + ' ' + options;

if (this.description) {
out += '\n\n' + this.description;
Expand Down
4 changes: 2 additions & 2 deletions test/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ describe('yeoman.generators.Base', function () {
var help = this.dummy.help();

assert.ok(help.match('Usage:'));
assert.ok(help.match('yeoman init FOO one two three \\[options\\]'));
assert.ok(help.match('yo \\[options\\]'));
assert.ok(help.match('A new desc for this generator'));
assert.ok(help.match('Options:'));
assert.ok(help.match('--help # Print generator\'s options and usage'));
Expand All @@ -268,7 +268,7 @@ describe('yeoman.generators.Base', function () {
describe('generator.usage()', function () {
it('should return the expected help / usage output', function () {
var usage = this.dummy.usage();
assert.equal(usage, 'yeoman init FOO one two three [options]\n\nA new desc for this generator');
assert.equal(usage, 'yo [options]\n\nA new desc for this generator');
});
});

Expand Down

0 comments on commit 4c21283

Please sign in to comment.