in src/common/Program.cs [248:301]
private static void DisplayParsedValues(INamedValues values)
{
if (values.GetOrDefault("x.quiet", true)) return;
if (!values.GetOrDefault("x.verbose", true)) return;
const string delimeters = "\r\n";
const string subKeyPostfix = ".key";
const string passwordPostfix = ".password";
const int maxValueLength = 100;
const int validSubKeyLength = 32;
var displayed = 0;
var keys = new SortedSet<string>(values.Names);
foreach (var key in keys)
{
if (key == "error") continue;
if (key == "display.help") continue;
if (key == "display.version") continue;
var value = values[key]!;
var obfuscateValue = key.EndsWith(passwordPostfix) ||
(key.Length > subKeyPostfix.Length && key.EndsWith(subKeyPostfix) &&
((value.Length == validSubKeyLength && Guid.TryParse(value, out Guid result)) ||
key.Contains("embedded"))); // embedded speech model key can be any length
if (obfuscateValue)
{
value = $" {value.Substring(0, 4)}****************************";
}
var lines = value.Split(delimeters.ToArray()).Where(x => x.Trim().Length > 0);
int chars = value.Length - maxValueLength;
value = lines.FirstOrDefault() ?? string.Empty;
var truncated = "";
if (lines.Count() > 1)
{
truncated = $" (+{lines.Count() - 1} line(s))";
value = "\"" + value.Substring(0, Math.Min(value.Length, maxValueLength)) + "...\"";
}
else if (chars > 0)
{
truncated = $" (+{chars} char(s))";
value = "\"" + value.Substring(0, Math.Min(value.Length, maxValueLength)) + "...\"";
}
Console.WriteLine($" {key}={value}{truncated}");
displayed++;
}
if (displayed > 0)
{
Console.WriteLine();
}
}