diff --git a/SabreTools.CommandLine/CommandSet.cs b/SabreTools.CommandLine/CommandSet.cs index 9e173e6..bc84597 100644 --- a/SabreTools.CommandLine/CommandSet.cs +++ b/SabreTools.CommandLine/CommandSet.cs @@ -42,6 +42,17 @@ namespace SabreTools.CommandLine #region Properties + /// + /// Custom help text to print instead of the automatically + /// generated generic help + /// + /// + /// This only replaces the automatically generated help + /// for . It does not impact + /// either or . + /// + public string? CustomHelp { get; set; } + /// /// Feature that represents the default functionality /// for a command set @@ -777,24 +788,34 @@ namespace SabreTools.CommandLine if (_header.Count > 0) output.AddRange(_header); - // Now append all available top-level flags - output.Add("Available options:"); - foreach (var input in _inputs.Values) + // If custom help text is defined + if (CustomHelp != null) { - var outputs = input.Format(pre: 2, midpoint: 30, detailed); - if (outputs != null) - output.AddRange(outputs); + CustomHelp = CustomHelp.Replace("\r\n", "\n"); + string[] customLines = CustomHelp.Split("\n"); + output.AddRange(customLines); } - - // If there is a default feature - if (DefaultFeature != null) + else { - foreach (var input in DefaultFeature.Children) + // Append all available top-level flags + output.Add("Available options:"); + foreach (var input in _inputs.Values) { - var outputs = input.Value.Format(pre: 2, midpoint: 30, detailed); + var outputs = input.Format(pre: 2, midpoint: 30, detailed); if (outputs != null) output.AddRange(outputs); } + + // If there is a default feature + if (DefaultFeature != null) + { + foreach (var input in DefaultFeature.Children) + { + var outputs = input.Value.Format(pre: 2, midpoint: 30, detailed); + if (outputs != null) + output.AddRange(outputs); + } + } } // Append the footer, if needed @@ -818,7 +839,7 @@ namespace SabreTools.CommandLine if (_header.Count > 0) output.AddRange(_header); - // Now append all available flags recursively + // Append all available flags recursively output.Add("Available options:"); foreach (var input in _inputs.Values) {