MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / install_ssh_config

Function install_ssh_config

crates/openshell-cli/src/ssh.rs:1570–1587  ·  view source on GitHub ↗
(gateway: &str, name: &str)

Source from the content-addressed store, hash-verified

1568}
1569
1570pub fn install_ssh_config(gateway: &str, name: &str) -> Result<PathBuf> {
1571 let managed_config = openshell_ssh_config_path()?;
1572 let main_config = user_ssh_config_path()?;
1573 ensure_openshell_include(&main_config, &managed_config)?;
1574
1575 if let Some(parent) = managed_config.parent() {
1576 openshell_core::paths::create_dir_restricted(parent)?;
1577 }
1578
1579 let alias = host_alias(name);
1580 let block = render_ssh_config(gateway, name);
1581 let contents = fs::read_to_string(&managed_config).unwrap_or_default();
1582 let updated = upsert_host_block(&contents, &alias, &block);
1583 fs::write(&managed_config, updated)
1584 .into_diagnostic()
1585 .wrap_err("failed to write OpenShell SSH config")?;
1586 Ok(managed_config)
1587}
1588
1589fn launch_editor(editor: Editor, host_alias: &str) -> Result<()> {
1590 launch_editor_command(

Calls 7

user_ssh_config_pathFunction · 0.85
ensure_openshell_includeFunction · 0.85
create_dir_restrictedFunction · 0.85
host_aliasFunction · 0.85
render_ssh_configFunction · 0.85
upsert_host_blockFunction · 0.85

Tested by

no test coverage detected