Improve %% escaping error message (#13018)

This commit is contained in:
Alexander Brassel 2025-03-04 08:03:11 -08:00 committed by GitHub
parent 9440feae7c
commit 82f8ac208f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 1 deletions

View file

@ -223,7 +223,11 @@ impl fmt::Display for ParseArgsError<'_> {
write!(f, "flag '--{flag}' missing an argument")
}
Self::MissingExpansionDelimiter { expansion } => {
write!(f, "missing a string delimiter after '%{expansion}'")
if expansion.is_empty() {
write!(f, "'%' was not properly escaped. Please use '%%'")
} else {
write!(f, "missing a string delimiter after '%{expansion}'")
}
}
Self::UnknownExpansion { kind } => {
write!(f, "unknown expansion '{kind}'")