diff --git a/wezterm-gui-subcommands/src/lib.rs b/wezterm-gui-subcommands/src/lib.rs index 0507717e1..47150f899 100644 --- a/wezterm-gui-subcommands/src/lib.rs +++ b/wezterm-gui-subcommands/src/lib.rs @@ -59,6 +59,23 @@ pub struct SshCommand { /// used instead. pub user_at_host_and_port: SshParameters, + /// Override specific SSH configuration options. + /// `wezterm ssh` is able to parse some (but not all!) options + /// from your `~/.ssh/config` and `/etc/ssh/ssh_config` files. + /// This command line switch allows you to override or otherwise + /// specify ssh_config style options. + /// + /// For example: + /// + /// `wezterm ssh -oIdentityFile=/secret/id_ed25519 some-host` + #[structopt( + long = "ssh-option", + short = "o", + name = "name=value", + parse(try_from_str = name_equals_value), + number_of_values = 1)] + pub config_override: Vec<(String, String)>, + /// Instead of executing your shell, run PROG. /// For example: `wezterm ssh user@host -- bash -l` will spawn bash /// as if it were a login shell. diff --git a/wezterm-gui/src/main.rs b/wezterm-gui/src/main.rs index 322cdc917..4bc0eff4c 100644 --- a/wezterm-gui/src/main.rs +++ b/wezterm-gui/src/main.rs @@ -94,6 +94,9 @@ async fn async_run_ssh(opts: SshCommand) -> anyhow::Result<()> { "user".to_string(), opts.user_at_host_and_port.username.to_string(), ); + for (k, v) in opts.config_override { + ssh_config.insert(k.to_lowercase().to_string(), v); + } let _gui = front_end().unwrap();