Skip to content

Commit d9e5d25

Browse files
committed
Make skip-builtin-servers flag more versatile
1 parent 44e33ea commit d9e5d25

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/AiCommand.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ class AiCommand extends WP_CLI_Command {
3030
* <prompt>
3131
* : AI prompt.
3232
*
33-
* [--skip-builtin-servers]
34-
* : Skip loading the built-in servers.
33+
* [--skip-builtin-servers[=<server>]]
34+
* : Skip loading the built-in servers for WP-CLI and the current WordPress site.
35+
* Can be set to 'all' (skip both), 'cli' (skip the WP-CLI server),
36+
* or 'wp' (skip the WordPress server).
3537
*
3638
* [--skip-wordpress]
3739
* : Run command without loading WordPress. (Not implemented yet)
@@ -78,9 +80,9 @@ public function __invoke( array $args, array $assoc_args ): void {
7880
WP_CLI::error( 'This command currently requires the AI Services plugin. You can install it with `wp plugin install ai-services --activate`.' );
7981
}
8082

81-
$with_builtin_servers = null === Utils\get_flag_value( $assoc_args, 'skip-builtin-servers' );
83+
$skip_builtin_servers = Utils\get_flag_value( $assoc_args, 'skip-builtin-servers', 'all' );
8284

83-
$sessions = $this->get_sessions( $with_wordpress && $with_builtin_servers, $with_builtin_servers );
85+
$sessions = $this->get_sessions( $with_wordpress && 'cli' === $skip_builtin_servers, 'wp' === $skip_builtin_servers );
8486
$tools = $this->get_tools( $sessions );
8587

8688
$approval_mode = (bool) Utils\get_flag_value( $assoc_args, 'approval-mode', false );

0 commit comments

Comments
 (0)