Example #1
0
 /// <summary>
 ///  Prints help about a certain configuration field
 /// </summary>
 /// <param name="fieldAttribute">The field attribute to print help for</param>
 /// <param name="width">The width of the console</param>
 /// <param name="indent">The indent to use</param>
 /// <param name="tw">The Textwriter to write the help to</param>
 public static void ConfigurationFieldHelp(CmdConfigurationFieldAttribute fieldAttribute, int width, int indent = 3,
                                           TextWriter tw = null)
 {
     tw = tw ?? Console.Out;
     tw.Write(CommandlineMethods.PadCentered(
                  $"{fieldAttribute.Name} (R{(fieldAttribute.IsReadonly ? "W" : "O")},{fieldAttribute.UnderlyingPropertyOrFieldInfo.ValueType})",
                  width));
     if (fieldAttribute.LongDescription is null)
     {
         if (fieldAttribute.Description is null)
         {
             tw.WriteLine("This value has no further description");
         }
         else
         {
             CommandlineMethods.PrintWithPotentialIndent(fieldAttribute.Description, width, indent, tw);
         }
     }
     else
     {
         foreach (string s in fieldAttribute.LongDescription)
         {
             CommandlineMethods.PrintWithPotentialIndent(s, width, 0, tw);
         }
     }
 }
Example #2
0
        /// <summary>
        ///  Prints help for a configurationField
        /// </summary>
        /// <param name="fieldAttribute">The configurationField to print help for</param>
        /// <param name="interpreter">The interpreter to use</param>
        /// <param name="showGenericConfigurationInfo"></param>
        public static void PrintConfigurationFieldHelp(CmdConfigurationFieldAttribute fieldAttribute, BaseInterpreter interpreter,
                                                       bool showGenericConfigurationInfo = false)
        {
            if (showGenericConfigurationInfo)
            {
                ConfigurationGenericHelp(interpreter, Console.WindowWidth, interpreter.TopInterpreter.Options.DefaultIndent);
            }

            ConfigurationFieldHelp(fieldAttribute, Console.WindowWidth, interpreter.TopInterpreter.Options.DefaultIndent);
        }