-
Notifications
You must be signed in to change notification settings - Fork 481
Closed
Description
FormatWithQuotesIfString
currently honors DateTime
, DateTimeOffset
and string
, but I'm using FileInfo
and DirectoryInfo
as options as well.
These types should also be surrounded by quotation marks when unparsed.
Affected code:
commandline/src/CommandLine/UnParserExtensions.cs
Lines 205 to 215 in 24e2be2
private static object FormatWithQuotesIfString(object value) | |
{ | |
if (value is DateTime || value is DateTimeOffset) return $"\"{value}\""; | |
Func<string, string> doubQt = v | |
=> v.Contains("\"") ? v.Replace("\"", "\\\"") : v; | |
return (value as string) | |
.ToMaybe() | |
.MapValueOrDefault(v => v.Contains(' ') || v.Contains("\"") | |
? "\"".JoinTo(doubQt(v), "\"") : v, value); | |
} |
IanKemp
Metadata
Metadata
Assignees
Labels
No labels