Use less verbose "detailed" instead of "includeLongDescription"

This commit is contained in:
Matt Nadareski
2025-10-05 10:26:18 -04:00
parent b20e609673
commit 8d7b52d5ef
3 changed files with 22 additions and 22 deletions

View File

@@ -184,7 +184,7 @@ namespace SabreTools.CommandLine
output.Add("Available options:");
foreach (var input in _inputs.Values)
{
var outputs = input.FormatRecursive(pre: 2, midpoint: 30, includeLongDescription: true);
var outputs = input.FormatRecursive(pre: 2, midpoint: 30, detailed: true);
if (outputs != null)
output.AddRange(outputs);
}
@@ -201,8 +201,8 @@ namespace SabreTools.CommandLine
/// Output a single feature recursively
/// </summary>
/// <param name="featureName">Name of the feature to output information for, if possible</param>
/// <param name="includeLongDescription">True if the long description should be formatted and output, false otherwise</param>
public void OutputFeatureHelp(string? featureName, bool includeLongDescription = false)
/// <param name="detailed">True if the long description should be formatted and output, false otherwise</param>
public void OutputFeatureHelp(string? featureName, bool detailed = false)
{
// If the feature name is null, empty, or just consisting of leading characters
string trimmedName = featureName?.TrimStart('-', '/', '\\') ?? string.Empty;
@@ -222,7 +222,7 @@ namespace SabreTools.CommandLine
// Append the formatted text
List<string> output = [];
output.Add($"Available options for {featureName}:");
output.AddRange(input.FormatRecursive(pre: 2, midpoint: 30, includeLongDescription));
output.AddRange(input.FormatRecursive(pre: 2, midpoint: 30, detailed));
// Now write out everything in a staged manner
WriteOutWithPauses(output);
@@ -243,7 +243,7 @@ namespace SabreTools.CommandLine
output.Add($"\"{featureName}\" not found. Did you mean:");
foreach (string possible in startsWith)
{
output.AddRange(_inputs[possible].Format(pre: 2, midpoint: 30, includeLongDescription));
output.AddRange(_inputs[possible].Format(pre: 2, midpoint: 30, detailed));
}
// Now write out everything in a staged manner

View File

@@ -36,7 +36,7 @@
// If we had something else after help
if (args.Length > 1)
{
parentSet?.OutputFeatureHelp(args[1], includeLongDescription: true);
parentSet?.OutputFeatureHelp(args[1], detailed: true);
return true;
}

View File

@@ -615,19 +615,19 @@ namespace SabreTools.CommandLine.Inputs
/// <summary>
/// Create formatted help text
/// </summary>
/// <param name="includeLongDescription">True if the long description should be formatted and output, false otherwise</param>
/// <param name="detailed">True if the long description should be formatted and output, false otherwise</param>
/// <returns>Help text formatted as a list of strings</returns>
public List<string> Format(bool includeLongDescription = false)
=> Format(pre: 0, midpoint: 0, includeLongDescription);
public List<string> Format(bool detailed = false)
=> Format(pre: 0, midpoint: 0, detailed);
/// <summary>
/// Create formatted help text
/// </summary>
/// <param name="pre">Positive number representing number of spaces to put in front of the feature</param>
/// <param name="midpoint">Positive number representing the column where the description should start</param>
/// <param name="includeLongDescription">True if the long description should be formatted and output, false otherwise</param>
/// <param name="detailed">True if the long description should be formatted and output, false otherwise</param>
/// <returns>Help text formatted as a list of strings</returns>
public List<string> Format(int pre, int midpoint, bool includeLongDescription = false)
public List<string> Format(int pre, int midpoint, bool detailed = false)
{
// Create the output list
List<string> outputList = [];
@@ -636,7 +636,7 @@ namespace SabreTools.CommandLine.Inputs
outputList.Add(FormatStandard(pre, midpoint));
// Add the long description, if needed
if (includeLongDescription)
if (detailed)
outputList.AddRange(FormatLongDescription(pre, midpoint));
return outputList;
@@ -645,20 +645,20 @@ namespace SabreTools.CommandLine.Inputs
/// <summary>
/// Create formatted help text including all children
/// </summary>
/// <param name="includeLongDescription">True if the long description should be formatted and output, false otherwise</param>
/// <param name="detailed">True if the long description should be formatted and output, false otherwise</param>
/// <returns>Help text formatted as a list of strings</returns>
public List<string> FormatRecursive(bool includeLongDescription = false)
=> FormatRecursive(tabLevel: 0, pre: 0, midpoint: 0, includeLongDescription);
public List<string> FormatRecursive(bool detailed = false)
=> FormatRecursive(tabLevel: 0, pre: 0, midpoint: 0, detailed);
/// <summary>
/// Create formatted help text including all children
/// </summary>
/// <param name="pre">Positive number representing number of spaces to put in front of the feature</param>
/// <param name="midpoint">Positive number representing the column where the description should start</param>
/// <param name="includeLongDescription">True if the long description should be formatted and output, false otherwise</param>
/// <param name="detailed">True if the long description should be formatted and output, false otherwise</param>
/// <returns>Help text formatted as a list of strings</returns>
public List<string> FormatRecursive(int pre, int midpoint, bool includeLongDescription = false)
=> FormatRecursive(tabLevel: 0, pre, midpoint, includeLongDescription);
public List<string> FormatRecursive(int pre, int midpoint, bool detailed = false)
=> FormatRecursive(tabLevel: 0, pre, midpoint, detailed);
/// <summary>
/// Pre-format the flags for output
@@ -785,9 +785,9 @@ namespace SabreTools.CommandLine.Inputs
/// <param name="tabLevel">Level of indentation for this feature</param>
/// <param name="pre">Positive number representing number of spaces to put in front of the feature</param>
/// <param name="midpoint">Positive number representing the column where the description should start</param>
/// <param name="includeLongDescription">True if the long description should be formatted and output, false otherwise</param>
/// <param name="detailed">True if the long description should be formatted and output, false otherwise</param>
/// <returns>Help text formatted as a list of strings</returns>
private List<string> FormatRecursive(int tabLevel, int pre = 0, int midpoint = 0, bool includeLongDescription = false)
private List<string> FormatRecursive(int tabLevel, int pre = 0, int midpoint = 0, bool detailed = false)
{
// Create the output list
List<string> outputList = [];
@@ -805,13 +805,13 @@ namespace SabreTools.CommandLine.Inputs
outputList.Add(FormatStandard(preAdjusted, midpointAdjusted));
// Add the long description, if needed
if (includeLongDescription)
if (detailed)
outputList.AddRange(FormatLongDescription(preAdjusted, midpointAdjusted));
// Append all children recursively
foreach (var feature in Children.Values)
{
outputList.AddRange(feature.FormatRecursive(tabLevel + 1, pre, midpoint, includeLongDescription));
outputList.AddRange(feature.FormatRecursive(tabLevel + 1, pre, midpoint, detailed));
}
return outputList;