Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 2, 2026

WP-CLI's --ssh flag only accepts connection strings, preventing users from passing tool-specific arguments like SSH options (-F config_file, -o ConnectTimeout=5), Docker flags (--env), or Vagrant parameters.

Changes

Config & Types

  • Added ssh-args to global config spec with multiple: true
  • Updated PHPStan GlobalConfig type definition
  • Added ssh-args to alias specification

Command Generation

  • Modified generate_ssh_command() to inject escaped args into all scheme commands (ssh, docker, docker-compose, docker-compose-run, vagrant)
  • Filter --ssh-args from remote WP-CLI invocation to prevent double-processing

Tests

  • Added scenarios for SSH, Docker, and multiple argument cases

Usage

# SSH with custom config (Lima, etc.)
wp --ssh=server --ssh-args="-F /path/to/config" core version

# Multiple args
wp --ssh=server --ssh-args="-o ConnectTimeout=5" --ssh-args="-o ServerAliveInterval=10" core version

# Docker with environment variables
wp --ssh=docker:wordpress --ssh-args="--env MY_VAR=value" core version

# In aliases
@prod:
  ssh: user@prod.example.com
  ssh-args:
    - "-F /path/to/config"
    - "-o ProxyJump=bastion"

All arguments are shell-escaped via escapeshellarg().

Original prompt

This section details on the original issue you should resolve

<issue_title>Support for ssh -F another_ssh_config server-alias/path</issue_title>
<issue_description>## Feature Request

Describe your use case and the problem you are facing

The way to connect to a Lima (Linux on macOS) guest is:

ssh -F config_file host_alias

Describe the solution you'd like

It might be helpful (if possible) to add a new alias such as ssh-config or ssh_config_file, to the --ssh option, allowing users to specify the SSH config file directly.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@swissspidy

This comment was marked as resolved.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for ssh -F option in commands Add global --ssh-args argument for SSH/Docker/Vagrant execution Feb 3, 2026
@codecov
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

❌ Patch coverage is 24.13793% with 22 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
php/WP_CLI/Runner.php 0.00% 22 Missing ⚠️

📢 Thoughts on this report? Let us know!

This comment was marked as resolved.

swissspidy and others added 2 commits February 2, 2026 20:36
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@swissspidy swissspidy closed this Feb 3, 2026
@swissspidy swissspidy deleted the copilot/support-ssh-config-option branch February 3, 2026 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for ssh -F another_ssh_config server-alias/path

2 participants