Repository navigation
Conversation
Previously, `ng completion` appended an unconditional `source <(ng completion script)` statement to the user's shell configuration file. When non-interactive shells (such as those spawned by scripts, automation tools, or coding agents) sourced the configuration file, they still paid the overhead of starting Node.js and generating the completion script despite tab completion not being used. This change wraps the `source <(ng completion script)` command in an `if [[ $- == *i* ]]; then` check so that autocompletion is only loaded when the shell is interactive, and updates the manual setup documentation accordingly. Closes angular#34307
There was a problem hiding this comment.
Code Review
This pull request wraps the Angular CLI autocompletion script loading in an interactive shell check (if [[ $- == *i* ]]; then ... fi) across the documentation, utility script, and E2E tests. The reviewer pointed out that using [[ and process substitution <(...) directly in startup files like .profile will cause syntax errors in POSIX-compliant shells (e.g., dash). To resolve this, the reviewer suggested a more robust, POSIX-compliant shell check using standard [, eval, and guards for BASH_VERSION or ZSH_VERSION across the utility script, documentation, and tests.
alan-agius4
approved these changes
Oct 19, 2026
dgp1130
approved these changes
Oct 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously,
ng completionappended an unconditionalsource <(ng completion script)statement to the user's shell configuration file. When non-interactive shells (such as those spawned by scripts, automation tools, or coding agents) sourced the configuration file, they still paid the overhead of starting Node.js and generating the completion script despite tab completion not being used.This change wraps the
source <(ng completion script)command in anif [[ $- == *i* ]]; thencheck so that autocompletion is only loaded when the shell is interactive, and updates the manual setup documentation accordingly.Closes #34307