Skip to content

Multiple steps needed to retrieve CLI version #27668

Closed
@medikoo

Description

@medikoo

Command

version

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

I've just installed @angular/cli and wanted to check the installed version. Intuitively I stared with ng --version (as such works for most CLI's, node and npm including), and this is what happened:

ng --version
Error: You need to specify a command before moving on. Use '--help' to view the available commands.
medikoo@medikoo-mac first-app-lesson-00 % ng --help   
ng <command>

Commands:
  ng add <collection>            Adds support for an external library to your project.
  ng analytics                   Configures the gathering of Angular CLI usage metrics.
  ng build [project]             Compiles an Angular application or library into an output directory named dist/ at the given output path.                               [aliases: b]
  ng cache                       Configure persistent disk cache and retrieve cache statistics.
  ng completion                  Set up Angular CLI autocompletion for your terminal.
  ng config [json-path] [value]  Retrieves or sets Angular configuration values in the angular.json file for the workspace.
  ng deploy [project]            Invokes the deploy builder for a specified project or for the default project in the workspace.
  ng doc <keyword>               Opens the official Angular documentation (angular.io) in a browser, and searches for a given keyword.                                   [aliases: d]
  ng e2e [project]               Builds and serves an Angular application, then runs end-to-end tests.                                                                   [aliases: e]
  ng extract-i18n [project]      Extracts i18n messages from source code.
  ng generate                    Generates and/or modifies files based on a schematic.                                                                                   [aliases: g]
  ng lint [project]              Runs linting tools on Angular application code in a given project folder.
  ng new [name]                  Creates a new Angular workspace.                                                                                                        [aliases: n]
  ng run <target>                Runs an Architect target with an optional custom builder configuration defined in your project.
  ng serve [project]             Builds and serves your application, rebuilding on file changes.                                                                         [aliases: s]
  ng test [project]              Runs unit tests in a project.                                                                                                           [aliases: t]
  ng update [packages..]         Updates your workspace and its dependencies. See https://update.angular.io/.
  ng version                     Outputs Angular CLI version.                                                                                                            [aliases: v]

Options:
  --help  Shows a help message for this command in the console.                                                                                                             [boolean]

For more information, see https://angular.io/cli/.
medikoo@medikoo-mac first-app-lesson-00 % hg version
zsh: command not found: hg
medikoo@medikoo-mac first-app-lesson-00 % ng version
? Would you like to enable autocompletion? This will set up your terminal so pressing TAB while typing Angular CLI commands will show possible options and autocomplete arguments. 
(Enabling autocompletion will modify configuration files in your home directory.) No
Ok, you won't be prompted again. Should you change your mind, the following command will set up autocompletion for you:

    ng completion
? Would you like to share pseudonymous usage data about this project with the Angular Team
at Google under Google's Privacy Policy at https://policies.google.com/privacy. For more
details and how to change this setting, see https://angular.io/analytics. Yes

Thank you for sharing pseudonymous usage data. Should you change your mind, the following
command will disable this feature entirely:

    ng analytics disable

Global setting: not set
Local setting: enabled
Effective status: enabled

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 17.2.3
Node: 20.13.1
Package Manager: npm 10.5.2
OS: darwin arm64

Angular: 17.2.4
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1702.3
@angular-devkit/build-angular   17.2.3
@angular-devkit/core            17.2.3
@angular-devkit/schematics      17.2.3
@angular/cli                    17.2.3
@schematics/angular             17.2.3
rxjs                            7.8.1
typescript                      4.9.5
zone.js                         0.14.6

It took me 5 interactions to successfully retrieve this information.

If not supporting --version option, I believe the settings questionare should not be forced on ng version command

Minimal Reproduction

ng --version

Exception or Error

No response

Your Environment

Angular CLI: 17.2.3
Node: 20.13.1
Package Manager: npm 10.5.2
OS: darwin arm64

Angular: 17.2.4
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1702.3
@angular-devkit/build-angular   17.2.3
@angular-devkit/core            17.2.3
@angular-devkit/schematics      17.2.3
@angular/cli                    17.2.3
@schematics/angular             17.2.3
rxjs                            7.8.1
typescript                      4.9.5
zone.js                         0.14.6

Anything else relevant?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions