Fix incorrect ToString() implementation on some models

This commit is contained in:
Alexey Golub
2019-08-18 13:57:10 +03:00
parent f5c34ca454
commit d5b95bf1f1
4 changed files with 5 additions and 5 deletions

View File

@@ -23,8 +23,8 @@ namespace CliFx.Internal
return index < 0 ? s : s.Substring(0, index);
}
public static StringBuilder AppendIfEmpty(this StringBuilder builder, char value) =>
builder.Length == 0 ? builder.Append(value) : builder;
public static StringBuilder AppendIfNotEmpty(this StringBuilder builder, char value) =>
builder.Length > 0 ? builder.Append(value) : builder;
public static TValue GetValueOrDefault<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dic, TKey key) =>
dic.TryGetValue(key, out var result) ? result : default;

View File

@@ -63,7 +63,7 @@ namespace CliFx.Models
foreach (var option in Options)
{
buffer.AppendIfEmpty(' ');
buffer.AppendIfNotEmpty(' ');
buffer.Append(option);
}

View File

@@ -54,7 +54,7 @@ namespace CliFx.Models
foreach (var value in Values)
{
buffer.AppendIfEmpty(' ');
buffer.AppendIfNotEmpty(' ');
var isEscaped = value.Contains(" ");

View File

@@ -51,7 +51,7 @@ namespace CliFx.Models
foreach (var option in Options)
{
buffer.AppendIfEmpty(' ');
buffer.AppendIfNotEmpty(' ');
buffer.Append('[');
buffer.Append(option);
buffer.Append(']');