Skip to content

Commit 41ab6c8

Browse files
alan-agius4clydin
authored andcommittedMay 21, 2024·
fix(@angular/cli): add --version option
This commit introduces the `--version` option, which will display the Angular CLI version when using `ng --version`. Closes #27668 (cherry picked from commit 386d766)
1 parent f4670fc commit 41ab6c8

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed
 

‎packages/angular/cli/src/command-builder/command-runner.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { colors } from '../utilities/color';
1919
import { AngularWorkspace, getWorkspace } from '../utilities/config';
2020
import { assertIsError } from '../utilities/error';
2121
import { PackageManagerUtils } from '../utilities/package-manager';
22+
import { VERSION } from '../utilities/version';
2223
import { CommandContext, CommandModuleError } from './command-module';
2324
import {
2425
CommandModuleConstructor,
@@ -122,7 +123,7 @@ export async function runCommand(args: string[], logger: logging.Logger): Promis
122123
.demandCommand(1, demandCommandFailureMessage)
123124
.recommendCommands()
124125
.middleware(normalizeOptionsMiddleware)
125-
.version(false)
126+
.version('version', 'Show Angular CLI version.', VERSION.full)
126127
.showHelpOnFail(false)
127128
.strict()
128129
.fail((msg, err) => {

‎tests/legacy-cli/e2e/tests/commands/help/help-json.ts

+5
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ export default async function () {
3636
'description': 'If provided, a new value for the given configuration key.',
3737
'positional': 1,
3838
},
39+
{
40+
'name': 'version',
41+
'type': 'boolean',
42+
'description': 'Show Angular CLI version.',
43+
},
3944
],
4045
});
4146

0 commit comments

Comments
 (0)
Please sign in to comment.