🌐 SSH Cfg

Crates.io docs.rs CI

Parses ~/.ssh/config asynchronously.

```rust use ssh_cfg::{SshConfigParser, SshOptionKey}; use tokio::runtime;

async fn parsesshconfig() -> Result<(), Box> { let sshconfig = SshConfigParser::parsehome().await?;

// Print first host config
if let Some((first_host, host_config)) = ssh_config.iter().next() {
    println!("Host: {}", first_host);

    // Print its configured SSH key if any
    if let Some(identity_file) = host_config.get(&SshOptionKey::IdentityFile) {
        println!("  {} {}", SshOptionKey::IdentityFile, identity_file);
    }
}

// Print all host configs
println!();
println!("{:#?}", ssh_config);

Ok(())

}

fn main() -> Result<(), Box> { let rt = runtime::Builder::newcurrentthread().build()?; rt.blockon(parsessh_config()) } ```

Currently values are stored as Strings. Ideally we would parse them into a strong data model.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.