mirror of
https://github.com/Tyrrrz/CliFx.git
synced 2025-10-25 15:19:17 +00:00
Fix incorrect ToString() implementation on some models
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace CliFx.Models
|
||||
|
||||
foreach (var option in Options)
|
||||
{
|
||||
buffer.AppendIfEmpty(' ');
|
||||
buffer.AppendIfNotEmpty(' ');
|
||||
buffer.Append(option);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace CliFx.Models
|
||||
|
||||
foreach (var value in Values)
|
||||
{
|
||||
buffer.AppendIfEmpty(' ');
|
||||
buffer.AppendIfNotEmpty(' ');
|
||||
|
||||
var isEscaped = value.Contains(" ");
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace CliFx.Models
|
||||
|
||||
foreach (var option in Options)
|
||||
{
|
||||
buffer.AppendIfEmpty(' ');
|
||||
buffer.AppendIfNotEmpty(' ');
|
||||
buffer.Append('[');
|
||||
buffer.Append(option);
|
||||
buffer.Append(']');
|
||||
|
||||
Reference in New Issue
Block a user