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

bug(help): resolve issue when using --help #3522

Merged
merged 1 commit into from
Dec 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/angular-cli/ember-cli/lib/cli/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ module.exports = CLI;
CLI.prototype.run = function(environment) {
return Promise.hash(environment).then(function(environment) {
var args = environment.cliArgs.slice();

if (args[0] === '--help') {
if (args.length === 1) {
args[0] = 'help';
} else {
args.shift();
args.push('--help');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Push back the same value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, --help is an option, not a command. So remove it from the start of the array and push it to the end.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, I was reading unshift. Cheers!

}
}

var commandName = args.shift();
var commandArgs = args;
var helpOptions;
Expand Down
9 changes: 9 additions & 0 deletions tests/e2e/tests/commands/help/help-option-command.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {silentNg} from '../../../utils/process';


export default function() {
return Promise.resolve()
.then(() => silentNg('--help', 'build'))
.then(() => process.chdir('/'))
.then(() => silentNg('--help', 'build'));
}
9 changes: 9 additions & 0 deletions tests/e2e/tests/commands/help/help-option.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {silentNg} from '../../../utils/process';


export default function() {
return Promise.resolve()
.then(() => silentNg('--help'))
.then(() => process.chdir('/'))
.then(() => silentNg('--help'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind trying with a command as well?

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {silentNg} from '../../utils/process';
import {silentNg} from '../../../utils/process';


export default function() {
Expand Down