Expand description
Provides functions to quote and possibly unquote strings with different quoting styles.
§Examples
use bstr::ByteSlice;
let shell_argument = gix_quote::single("hello it's git!".into());
assert_eq!(shell_argument, "'hello it'\\''s git'\\!''");
let input = br#""line\nbreak""#.as_bstr();
let (unquoted, consumed) = gix_quote::ansi_c::undo(input).unwrap();
assert_eq!(unquoted.as_ref(), b"line\nbreak".as_bstr());
assert_eq!(consumed, input.len());Modules§
Functions§
- single
- Transforms the given
valueto be suitable for use as an argument for Bourne shells by wrapping it into single quotes.