wezterm-gui: add wezterm ssh -oIdentityFile=/some/thing
Allow overriding ssh config options from the command line. I don't want to replicate the many options that `ssh(1)` has; this just exposes the `-oNAME=VALUE` syntax. The config names are those from `man ssh_config`; `IdentityFile` rather than `-i`. refs: #457
This commit is contained in:
1 parent
a3a07c8da5
commit
32fa186c99
2 files changed
+20
No files matched your search
@@ -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.
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in new issue
Block a user