-
Notifications
You must be signed in to change notification settings - Fork 18
Add --no-interaction flag to prevent Git/SSH prompts in package commands #206
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
base: main
Are you sure you want to change the base?
Changes from all commits
3edda0e
415fb60
f8ca62d
e68d8d6
60df40b
249e76e
0a6dc7f
a6df039
27ab934
1b84407
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -199,6 +199,9 @@ public function browse( $_, $assoc_args ) { | |||||
| * [--insecure] | ||||||
| * : Retry downloads without certificate validation if TLS handshake fails. Note: This makes the request vulnerable to a MITM attack. | ||||||
| * | ||||||
| * [--interaction] | ||||||
| * : Control interactive mode. Use `--no-interaction` to disable prompts (interactive by default). Useful for scripting. | ||||||
| * | ||||||
| * ## EXAMPLES | ||||||
| * | ||||||
| * # Install a package hosted at a git URL. | ||||||
|
|
@@ -216,7 +219,12 @@ public function browse( $_, $assoc_args ) { | |||||
| public function install( $args, $assoc_args ) { | ||||||
| list( $package_name ) = $args; | ||||||
|
|
||||||
| $insecure = (bool) Utils\get_flag_value( $assoc_args, 'insecure', false ); | ||||||
| $insecure = (bool) Utils\get_flag_value( $assoc_args, 'insecure', false ); | ||||||
| $interaction = Utils\get_flag_value( $assoc_args, 'interaction', true ); | ||||||
|
|
||||||
| if ( ! $interaction ) { | ||||||
| $this->set_non_interactive_mode(); | ||||||
| } | ||||||
|
|
||||||
| $this->set_composer_auth_env_var(); | ||||||
| $git_package = false; | ||||||
|
|
@@ -503,6 +511,11 @@ public function path( $args ) { | |||||
| /** | ||||||
| * Updates all installed WP-CLI packages to their latest version. | ||||||
| * | ||||||
| * ## OPTIONS | ||||||
| * | ||||||
| * [--interaction] | ||||||
| * : Boolean flag that controls interactive mode (enabled by default). Use `--no-interaction` to disable prompts, which is useful for scripting. | ||||||
| * | ||||||
| * ## EXAMPLES | ||||||
| * | ||||||
| * $ wp package update | ||||||
|
|
@@ -518,8 +531,17 @@ public function path( $args ) { | |||||
| * Generating autoload files | ||||||
| * --- | ||||||
| * Success: Packages updated. | ||||||
| * | ||||||
| * @param array $_ Unused positional arguments (none expected). | ||||||
| * @param array $assoc_args Associative array of options. | ||||||
| */ | ||||||
| public function update() { | ||||||
| public function update( $_, $assoc_args = [] ) { | ||||||
| $interaction = Utils\get_flag_value( $assoc_args, 'interaction', true ); | ||||||
|
||||||
| $interaction = Utils\get_flag_value( $assoc_args, 'interaction', true ); | |
| $interaction = (bool) Utils\get_flag_value( $assoc_args, 'interaction', true ); |
Copilot
AI
Dec 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The interaction flag should be explicitly cast to boolean like the insecure flag on line 602 for consistency and type safety. While Utils\get_flag_value returns a boolean-ish value, explicit casting makes the intent clear and ensures consistent behavior.
| $interaction = Utils\get_flag_value( $assoc_args, 'interaction', true ); | |
| $interaction = (bool) Utils\get_flag_value( $assoc_args, 'interaction', true ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
interactionflag should be explicitly cast to boolean like theinsecureflag on line 222 for consistency and type safety. WhileUtils\get_flag_valuereturns a boolean-ish value, explicit casting makes the intent clear and ensures consistent behavior.