mirror of
https://github.com/Tyrrrz/CliFx.git
synced 2025-10-25 15:19:17 +00:00
Show default values for optional parameters (#122)
This commit is contained in:
@@ -207,6 +207,12 @@ internal class HelpConsoleFormatter : ConsoleFormatter
|
||||
Write(' ');
|
||||
}
|
||||
|
||||
// Default value
|
||||
if (!parameterSchema.IsRequired)
|
||||
{
|
||||
WriteDefaultValue(parameterSchema);
|
||||
}
|
||||
|
||||
WriteLine();
|
||||
}
|
||||
}
|
||||
@@ -298,7 +304,16 @@ internal class HelpConsoleFormatter : ConsoleFormatter
|
||||
// Default value
|
||||
if (!optionSchema.IsRequired)
|
||||
{
|
||||
var defaultValue = _context.CommandDefaultValues.GetValueOrDefault(optionSchema);
|
||||
WriteDefaultValue(optionSchema);
|
||||
}
|
||||
|
||||
WriteLine();
|
||||
}
|
||||
}
|
||||
|
||||
private void WriteDefaultValue(IMemberSchema schema)
|
||||
{
|
||||
var defaultValue = _context.CommandDefaultValues.GetValueOrDefault(schema);
|
||||
if (defaultValue is not null)
|
||||
{
|
||||
// Non-Scalar
|
||||
@@ -348,10 +363,6 @@ internal class HelpConsoleFormatter : ConsoleFormatter
|
||||
}
|
||||
}
|
||||
|
||||
WriteLine();
|
||||
}
|
||||
}
|
||||
|
||||
private void WriteCommandChildren()
|
||||
{
|
||||
var childCommandSchemas = _context
|
||||
|
||||
Reference in New Issue
Block a user