public string GetIndividualHelpString(ArgumentKey k)
        {
            StringBuilder  builder = new StringBuilder();
            IArgumentValue value2  = this.m_Switches[k];

            builder.Append("[" + k.Prefix + k.Symbol.ToUpper() + value2.ArgumentString() + "] ");
            string str = k.Symbol.ToUpper();

            if (k.Name.ToUpper().StartsWith(k.Symbol.ToUpper()))
            {
                str = str + k.Name.Substring(k.Symbol.Length);
            }
            else
            {
                str = str + " (" + k.Name + ")";
            }
            builder.AppendLine("  " + k.Prefix + str);
            builder.AppendLine("  " + value2.ShortHelp);
            builder.AppendLine();
            if (Helper.IsNotNullOrEmpty(value2.Help))
            {
                builder.AppendLine(ConsoleFormatter.StripFormat(value2.Help));
                builder.AppendLine();
            }
            return(builder.ToString());
        }
Exemple #2
0
 public static void WriteInterpretedLine(string buffer)
 {
     ConsoleFormatter.WriteInterpretedLine(m_SystemConsole, buffer);
 }
Exemple #3
0
 public static void WriteInterpreted(ConsoleThemeColor colour, string buffer, int paddingLeft, int paddingRight)
 {
     ConsoleFormatter.WriteInterpreted(m_SystemConsole, Theme[colour], buffer, paddingLeft, paddingRight);
 }
Exemple #4
0
 public static void WriteInterpreted(string buffer, int paddingLeft, int paddingRight)
 {
     ConsoleFormatter.WriteInterpreted(m_SystemConsole, buffer, paddingLeft, paddingRight);
 }
        public void WriteApplicationDocumentationToPath(string path)
        {
            StringBuilder builder = new StringBuilder();

            if (this.m_AboutTitleText != null)
            {
                builder.AppendLine(ConsoleFormatter.StripFormat(this.m_AboutTitleText));
                builder.AppendLine();
            }
            if (this.m_CreditsText != null)
            {
                builder.AppendLine(ConsoleFormatter.StripFormat(this.m_CreditsText));
                builder.AppendLine();
            }
            if (this.m_AboutText != null)
            {
                builder.AppendLine(ConsoleFormatter.StripFormat(this.m_AboutText));
                builder.AppendLine();
            }
            if (this.m_AboutTextLong != null)
            {
                builder.AppendLine(ConsoleFormatter.StripFormat(this.m_AboutTextLong));
                builder.AppendLine();
            }
            builder.AppendLine();
            builder.AppendLine();
            builder.AppendLine(new string('=', RugConsole.BufferWidth));
            builder.AppendLine();
            builder.AppendLine(ConsoleFormatter.StripFormat(string.Format("{0}:", Strings.ArgumentParser_AboutScreen_Usage)));
            if (this.m_UsageText != null)
            {
                builder.AppendLine(ConsoleFormatter.StripFormat(this.m_UsageText));
                builder.AppendLine();
                builder.AppendLine();
            }
            builder.AppendLine(this.GetLongArgumentsUsage());
            builder.AppendLine();
            if ((this.m_FirstArgument != null) && Helper.IsNotNullOrEmpty(this.m_FirstArgument.Help))
            {
                builder.AppendLine(new string('-', RugConsole.BufferWidth));
                builder.AppendLine("<" + this.m_FirstArgument.ArgumentString().Trim() + ">");
                builder.AppendLine(ConsoleFormatter.StripFormat(this.m_FirstArgument.Help));
                builder.AppendLine();
            }
            if ((this.m_DefaultArgument != null) && Helper.IsNotNullOrEmpty(this.m_DefaultArgument.Help))
            {
                builder.AppendLine(new string('-', RugConsole.BufferWidth));
                builder.AppendLine("<" + this.m_DefaultArgument.ArgumentString().Trim() + ">");
                builder.AppendLine(ConsoleFormatter.StripFormat(this.m_DefaultArgument.Help));
                builder.AppendLine();
            }
            foreach (ArgumentKey key in this.m_Switches.Keys)
            {
                builder.AppendLine(new string('-', RugConsole.BufferWidth));
                builder.Append(this.GetIndividualHelpString(key));
            }
            if (this.m_LegalText != null)
            {
                builder.AppendLine();
                builder.AppendLine();
                builder.AppendLine(new string('=', RugConsole.BufferWidth));
                builder.AppendLine(ConsoleFormatter.StripFormat(this.m_LegalText));
                builder.AppendLine();
            }
            try
            {
                File.WriteAllText(path, builder.ToString());
                RugConsole.Write(ConsoleVerbosity.Normal, ConsoleThemeColor.Text1, string.Format(Strings.ArgumentParser_DocumentationWrittenToPath, path));
            }
            catch (Exception exception)
            {
                RugConsole.WriteException(10, string.Format(Strings.Error_0010, path), exception);
            }
        }