diff --git a/packages/@angular/cli/commands/get.ts b/packages/@angular/cli/commands/get.ts index ee0bca96ab35..9b8edd9aca89 100644 --- a/packages/@angular/cli/commands/get.ts +++ b/packages/@angular/cli/commands/get.ts @@ -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 [key]', works: 'everywhere', availableOptions: [ @@ -32,6 +32,10 @@ const GetCommand = Command.extend({ + 'you need the --global argument.'); } + if (!rawArgs[0]) { + throw new SilentError('No key specified. Run "ng help get" for usage.'); + } + const value = config.get(rawArgs[0]); if (value === null || value === undefined) { diff --git a/tests/e2e/tests/commands/get/get.ts b/tests/e2e/tests/commands/get/get.ts index b66fb2e9ceb1..09ca1cf46984 100644 --- a/tests/e2e/tests/commands/get/get.ts +++ b/tests/e2e/tests/commands/get/get.ts @@ -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'))) .then(() => ng('get', 'apps.0.prefix')) .then(({ stdout }) => { if (!stdout.match(/app/)) {