Skip to main content

Crate gix_quote

Crate gix_quote 

Source
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§

ansi_c

Functions§

single
Transforms the given value to be suitable for use as an argument for Bourne shells by wrapping it into single quotes.