pub fn quote_path_for_ssh_config(path: &Path) -> StringExpand description
Quote a filesystem path for embedding in an SSH-style config file.
On Windows, backslashes are converted to forward slashes — this is required by OpenSSH’s config parser and by Git credential helper entries, which also use the same forward-slash convention.
Paths containing spaces are wrapped in double quotes.
§⚠ Not suitable for all config formats
This function normalises Windows backslashes to forward slashes. Do not
use it for formats that require backslash-escaped paths (e.g. the AWS
credential_process INI directive). Use quote_credential_process_arg
for those.
§Usage
use hardware_enclave::shell::quote_path_for_ssh_config;
use std::path::Path;
let line = format!("IdentityFile {}", quote_path_for_ssh_config(Path::new("/home/user/.ssh/id")));