toYaml method
The spills: yaml section, only the non-default values — the file
stays minimal (defaults are never written). Empty at the defaults,
so CliConfig.toYaml embeds it only when explicitly configured
(gh-1572: the section used to be unrenderable and silently dropped
by every save).
Implementation
String toYaml() {
if (enabled &&
threshold == 8192 &&
headChars == 2000 &&
tailChars == 2000) {
return '';
}
final buffer = StringBuffer('spills:\n');
if (!enabled) buffer.write(' enabled: false\n');
if (threshold != 8192) buffer.write(' threshold: $threshold\n');
if (headChars != 2000) buffer.write(' headChars: $headChars\n');
if (tailChars != 2000) buffer.write(' tailChars: $tailChars\n');
return buffer.toString();
}