public virtual void WriteTypeContent(TypeHelpRequest helpRequest) { var consoleWidth = GetConsoleWidth(); var argumentHelps = GetHelpForProperties(helpRequest.Type).OrderByDescending(x => x.Priority).ToList(); if (argumentHelps.Count == 0) { OnNoPropertyHelpAvailable(); return; } int longestNameWidth = argumentHelps.Select(a => a.PropertyName.Length).Max() + 2; int longestAliasWidth = argumentHelps.Select(a => a.AliasString.Length).Max() + 4; int descriptionWidth = consoleWidth - longestNameWidth - longestAliasWidth; int leftWidth = consoleWidth - descriptionWidth; foreach (ArgumentHelp argumentHelp in argumentHelps) { BeforerArgument(argumentHelp); WriteArgument(argumentHelp, longestNameWidth, longestAliasWidth, descriptionWidth, leftWidth); AfterArgument(argumentHelp); } }
/// <summary>Prints the help.</summary> /// <param name="type">Type of the argument.</param> public void PrintTypeHelp(Type type) { var helpRequest = new TypeHelpRequest(type); WriteTypeHeader(helpRequest); WriteTypeContent(helpRequest); WriteTypeFooter(helpRequest); }
public virtual void WriteTypeHeader(TypeHelpRequest helpRequest) { if (helpRequest.Type.IsCommandType()) { Console.WriteLine($"Help for the '{GetCommandName(helpRequest.Type)}' command"); Console.WriteLine(); return; } if (helpRequest.Type.IsClass) { Console.WriteLine("Help for the command line arguments that are supported"); Console.WriteLine(); } }
/// <summary>Writes the footer for a type help request.</summary> /// <param name="helpRequest"></param> public virtual void WriteTypeFooter(TypeHelpRequest helpRequest) { WriteSeparator(); }