borgbackup 0.10.1

A wapper for the borgbackup utility
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/// Helper function for shell escaping
///
/// It will try to quote the entire string and escape characters within that need escaping
pub(crate) fn shell_escape(input: &str) -> String {
    let mut s = String::new();
    s.push('\'');
    for c in input.chars() {
        match c {
            '\'' => s.push_str(r#"\'"#),
            '\\' => s.push_str(r#"\\"#),
            _ => s.push(c),
        }
    }
    s.push('\'');
    s
}