Skip to content

Commit

Permalink
doc: Clarify description of single escaping
Browse files Browse the repository at this point in the history
This improves how `gix_quote::single` documents how it handles the
cases it treats specially.

The fix in #717 (discussed in #713) wasn't accompanied by a change
to the documentation, which continued either to describe the
preceding behavior or to be ambiguous. This changes it to describe
the current behavior unambiguously. Only documentation is changed.
  • Loading branch information
EliahKagan committed Jan 26, 2025
1 parent 810b5cf commit d731a1c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gix-quote/src/single.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use bstr::{BStr, BString, ByteSlice, ByteVec};

/// Transforms the given `value` to be suitable for use as an argument for Bourne shells by wrapping it into single quotes.
///
/// Every single-quote `'` is escaped with `\'`, every exclamation mark `!` is escaped with `\!`, and the entire string is enclosed
/// in single quotes.
/// Every single-quote `'` is escaped as `'\''`, every exclamation mark `!` is escaped as `'\!'`,
/// and the entire string is enclosed in single quotes.
pub fn single(mut value: &BStr) -> BString {
let mut quoted = BString::new(b"'".to_vec());

Expand Down

0 comments on commit d731a1c

Please sign in to comment.