1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright 2026 Jay Gowdy
// SPDX-License-Identifier: MIT
//! Shell config block injection and path/value quoting.
//!
//! [`BlockMarkers`] + the `install_block_in_file` / `remove_block_from_file`
//! functions handle adding and removing managed blocks from `.bashrc`,
//! `.zshrc`, SSH config, and similar files.
//!
//! The quoting functions produce correctly-escaped strings for embedding
//! paths and values into config files.
// Config block management
pub use crate;
// Path and value quoting for config files
pub use cratequote_config_value;
/// 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")));
/// ```
/// Quote a path for the `credential_process` directive in AWS config.
///
/// Uses INI-style escaping (`\"` and `\\`) rather than forward-slash
/// normalisation. Use this for AWS `~/.aws/credentials` or `~/.aws/config`
/// entries. For SSH config paths use [`quote_path_for_ssh_config`] instead.
pub use cratequote_credential_process_arg;