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

fix(@angular/cli): ng get: return whole config root when no path provided. #5887

Closed
wants to merge 8 commits into from

Conversation

prestonvanloon
Copy link
Contributor

@prestonvanloon prestonvanloon commented Apr 8, 2017

Running ng get without a config key would throw a invalidJsonPath error rather than a meaningful message.

This PR

  • returns the whole config object when no json path provided.
  • pretty prints the object using JSON.stringify(value, null, 2).

Fixes #5886

@@ -11,7 +11,7 @@ export interface GetOptions {

const GetCommand = Command.extend({
name: 'get',
description: 'Get a value from the configuration.',
description: 'Get a value from the configuration. Example: ng get project.name',
Copy link
Contributor

Choose a reason for hiding this comment

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

@prestonvanloon Please change this to match format eg. "ng new [name]".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -4,6 +4,7 @@ import {expectToFail} from '../../../utils/utils';
export default function() {
return Promise.resolve()
.then(() => expectToFail(() => ng('get', 'apps.zzz.prefix')))
.then(() => expectToFail(() => ng('get', undefined)))
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be just ng('get') as ng get undefined seems to be working fine already as it is converted to string key.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@prestonvanloon
Copy link
Contributor Author

I think this should be closed in favor of returning the whole config object when no param specified.

I'll submit a new PR later.

@prestonvanloon
Copy link
Contributor Author

Or this PR modified to return the whole object. Not sure what is preferred.

@prestonvanloon prestonvanloon changed the title fix(@angular/cli): Throw error when no key provided for ng get fix(@angular/cli): ng get: return whole config root when no path provided. Apr 9, 2017
@prestonvanloon
Copy link
Contributor Author

I updated this PR title, description, and content with the changes outlined in my previous comment.

@filipesilva
Copy link
Contributor

Heya @prestonvanloon thanks for the work here. Can you rebase this PR? There's a couple of CI errors that were due to changes on our side, but it should be fine now.

@prestonvanloon
Copy link
Contributor Author

@filipesilva OK. Should be all good now. Thanks!

@hansl hansl closed this in 382ba8d May 9, 2017
hansl pushed a commit that referenced this pull request May 9, 2017
filipesilva pushed a commit to filipesilva/angular-cli that referenced this pull request May 9, 2017
filipesilva pushed a commit to filipesilva/angular-cli that referenced this pull request May 9, 2017
@prestonvanloon prestonvanloon deleted the fix/ng-get branch May 11, 2017 02:56
dond2clouds pushed a commit to d2clouds/speedray-cli that referenced this pull request Apr 23, 2018
dond2clouds pushed a commit to d2clouds/speedray-cli that referenced this pull request Apr 23, 2018
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ng get causes InvalidJsonPath error
4 participants