public string GetShortArgumentsUsage() { StringBuilder builder = new StringBuilder(); new StringBuilder(); builder.AppendLine(this.m_Description); builder.AppendLine(""); builder.Append(this.m_AppName.ToUpper() + " "); if (this.m_FirstArgument != null) { builder.Append("<" + this.m_FirstArgument.ArgumentString().Trim() + "> "); } if (this.m_DefaultArgument != null) { builder.Append("<" + this.m_DefaultArgument.ArgumentString().Trim() + "> "); } foreach (ArgumentKey key in this.m_Switches.Keys) { IArgumentValue value2 = this.m_Switches[key]; builder.Append("[" + key.Prefix + key.Symbol.ToUpper() + value2.ArgumentString() + "] "); } if (this.HasApplicationAbout) { builder.Append("/?? "); } if (this.HasApplicationDocument) { builder.Append("/?D <" + Strings.ArgumentParser_Documentation_NameForPath + "> "); } builder.AppendLine(""); builder.AppendLine(""); return(builder.ToString()); }
public void WriteIndividualHelpToConsole(ArgumentKey k) { ConsoleColorState colorState = RugConsole.ColorState; IArgumentValue value2 = this.m_Switches[k]; RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.SubText, new string('-', RugConsole.BufferWidth) + "["); RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.TitleText, k.Prefix + k.Symbol.ToUpper()); RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.Text, value2.ArgumentString()); RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.SubText, "] "); RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.TitleText, " " + k.Prefix + k.Symbol.ToUpper()); if (k.Name.ToUpper().StartsWith(k.Symbol.ToUpper())) { RugConsole.WriteLine(ConsoleVerbosity.Silent, ConsoleThemeColor.Text, k.Name.Substring(k.Symbol.Length).PadRight(15 - k.Symbol.Length)); } else { RugConsole.WriteLine(ConsoleVerbosity.Silent, ConsoleThemeColor.Text, (" (" + k.Name + ")").PadRight(15 - k.Symbol.Length)); } RugConsole.WriteLine(ConsoleVerbosity.Silent, ConsoleThemeColor.Text1, " " + value2.ShortHelp); RugConsole.WriteLine(ConsoleVerbosity.Silent, ConsoleThemeColor.TitleText, ""); if (Helper.IsNotNullOrEmpty(value2.Help)) { RugConsole.WriteInterpreted(ConsoleThemeColor.TitleText, value2.Help, 2, 2); RugConsole.WriteLine(ConsoleVerbosity.Silent, ""); } RugConsole.ColorState = colorState; }
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()); }
public void WriteShortArgumentsUsage() { ConsoleColorState colorState = RugConsole.ColorState; RugConsole.ForegroundThemeColor = ConsoleThemeColor.TitleText; RugConsole.WriteLine(ConsoleVerbosity.Silent, this.m_Description); RugConsole.WriteLine(ConsoleVerbosity.Silent); int count = this.m_AppName.Length + 1; int num2 = count; RugConsole.Write(ConsoleVerbosity.Silent, this.m_AppName.ToUpper() + " "); if (this.m_FirstArgument != null) { string str = "<" + this.m_FirstArgument.ArgumentString().Trim() + "> "; num2 += str.Length + str.Length; if (num2 > RugConsole.BufferWidth) { num2 = count; RugConsole.WriteLine(); RugConsole.Write(new string(' ', count)); } RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.SubText2, str); } if (this.m_DefaultArgument != null) { string str2 = "<" + this.m_DefaultArgument.ArgumentString().Trim() + "> "; num2 += str2.Length; if (num2 > RugConsole.BufferWidth) { num2 = count + str2.Length; RugConsole.WriteLine(); RugConsole.Write(new string(' ', count)); } RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.SubText3, str2); } foreach (ArgumentKey key in this.m_Switches.Keys) { IArgumentValue value2 = this.m_Switches[key]; int num3 = ((key.Prefix.Length + key.Symbol.Length) + value2.ArgumentString().Length) + 3; num2 += num3; if (num2 > RugConsole.BufferWidth) { num2 = count + num3; RugConsole.WriteLine(); RugConsole.Write(new string(' ', count)); } RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.SubText, "["); RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.TitleText, key.Prefix + key.Symbol.ToUpper()); RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.Text, value2.ArgumentString()); RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.SubText, "] "); } if (this.HasApplicationAbout) { int num4 = 4; num2 += num4; if (num2 > RugConsole.BufferWidth) { num2 = count + num4; RugConsole.WriteLine(); RugConsole.Write(new string(' ', count)); } RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.WarningColor2, "/?? "); } if (this.HasApplicationDocument) { int num5 = 11; num2 += num5; if (num2 > RugConsole.BufferWidth) { num2 = count + num5; RugConsole.WriteLine(); RugConsole.Write(new string(' ', count)); } RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.WarningColor2, "/?D <path> "); } RugConsole.ColorState = colorState; RugConsole.WriteLine(ConsoleVerbosity.Silent); RugConsole.WriteLine(ConsoleVerbosity.Silent); }