本文整理汇总了C#中CommandLine.Text.HelpText.RenderParsingErrorsText方法的典型用法代码示例。如果您正苦于以下问题:C# HelpText.RenderParsingErrorsText方法的具体用法?C# HelpText.RenderParsingErrorsText怎么用?C# HelpText.RenderParsingErrorsText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommandLine.Text.HelpText
的用法示例。
在下文中一共展示了HelpText.RenderParsingErrorsText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetUsage
public string GetUsage()
{
string processname = Process.GetCurrentProcess().ProcessName;
var help = new HelpText
{
AdditionalNewLineAfterOption = false,
AddDashesToOption = true,
Copyright = new CopyrightInfo("Geoffrey Huntley <[email protected]>", DateTime.Now.Year),
MaximumDisplayWidth = 160,
};
help.AddPreOptionsLine(Environment.NewLine);
help.AddPreOptionsLine(
String.Format(
"Usage: {0} --destination C:\\backups\\ --sleep 600 --instance https://yourinstance.atlassian.net --username admin --password password",
processname));
help.AddOptions(this);
if (LastParserState.Errors.Count <= 0) return help;
string errors = help.RenderParsingErrorsText(this, 2); // indent with two spaces
if (!string.IsNullOrEmpty(errors))
{
help.AddPostOptionsLine(Environment.NewLine);
help.AddPostOptionsLine("ERROR(s):");help.AddPostOptionsLine(Environment.NewLine);
help.AddPostOptionsLine(errors);
}
return help;
}
示例2: GetUsage
public string GetUsage()
{
var help = new HelpText
{
Heading = new HeadingInfo("#b#Versionr## #q#- the less hateful version control system.##"),
AddDashesToOption = true,
};
help.FormatOptionHelpText += Help_FormatOptionHelpText;
// ...
if (LastParserState != null && LastParserState.Errors.Any())
{
var errors = help.RenderParsingErrorsText(this, 2); // indent with two spaces
if (!string.IsNullOrEmpty(errors))
{
help.AddPreOptionsLine(string.Concat(Environment.NewLine, "Invalid command:"));
help.AddPreOptionsLine(errors);
}
}
help.AddPreOptionsLine(string.Format("\nUsage:\n {0}\n", Usage));
help.AddPreOptionsLine(string.Format("##The `#b#{0}##` Command:", Verb));
foreach (var x in Description)
help.AddPreOptionsLine(" " + x);
help.AddPreOptionsLine("\n##Options:#b#");
help.AddOptions(this);
return help;
}
示例3: GetUsage
public string GetUsage()
{
var help = new HelpText
{
Heading = new HeadingInfo("CqlSharp.Performance.Client", "0.1.0"),
Copyright = new CopyrightInfo("Joost Reuzel", 2014),
AdditionalNewLineAfterOption = true,
AddDashesToOption = true
};
if(LastParserState.Errors.Any())
{
var errors = help.RenderParsingErrorsText(this, 2); // indent with two spaces
if(!string.IsNullOrEmpty(errors))
{
help.AddPreOptionsLine(string.Concat(Environment.NewLine, "ERROR(S):"));
help.AddPreOptionsLine(errors);
}
}
help.AddPreOptionsLine("Usage: Client -c 100 -r 10000");
help.AddOptions(this);
return help;
}
示例4: GetUsage
public string GetUsage()
{
var name = Assembly.GetExecutingAssembly().GetName();
var help = new HelpText
{
Heading = new HeadingInfo(name.Name, name.Version.ToString()),
Copyright = new CopyrightInfo("me!", 2015),
AdditionalNewLineAfterOption = true,
AddDashesToOption = true
};
if (LastParserState.Errors.Any())
{
var errors = help.RenderParsingErrorsText(this, 2);
if (!string.IsNullOrEmpty(errors))
{
help.AddPreOptionsLine(string.Concat(Environment.NewLine, "ERROR(S):"));
help.AddPreOptionsLine(errors);
}
}
help.AddPreOptionsLine("Usage: RunMongoRun [options]");
help.AddOptions(this);
return help;
}
示例5: HandleParsingErrorsInHelp
private void HandleParsingErrorsInHelp(HelpText help)
{
string errors = help.RenderParsingErrorsText(this);
if (!string.IsNullOrEmpty(errors))
{
help.AddPreOptionsLine(string.Concat(Environment.NewLine, "ERROR: ", errors, Environment.NewLine));
}
}
示例6: HandleParsingErrorsInHelp
private void HandleParsingErrorsInHelp(HelpText help)
{
if (LastParserState != null && LastParserState.Errors.Any()) {
var errors = help.RenderParsingErrorsText(this, 2);
if (!string.IsNullOrEmpty(errors)) {
help.AddPreOptionsLine(Environment.NewLine + "Error(s):");
help.AddPreOptionsLine(errors);
}
}
}
示例7: GetUsage
public string GetUsage()
{
var asm = Assembly.GetExecutingAssembly();
var productName =
asm.GetCustomAttributes(typeof (AssemblyTitleAttribute), false)
.OfType<AssemblyTitleAttribute>()
.Single()
.Title;
var productVersion =
asm.GetCustomAttributes(typeof (AssemblyInformationalVersionAttribute), false)
.OfType<AssemblyInformationalVersionAttribute>()
.Single()
.InformationalVersion;
var productCopyright =
asm.GetCustomAttributes(typeof (AssemblyCopyrightAttribute), false)
.OfType<AssemblyCopyrightAttribute>()
.Single()
.Copyright;
var help = new HelpText
{
AddDashesToOption = true,
AdditionalNewLineAfterOption = true,
Copyright = productCopyright,
Heading = new HeadingInfo(productName, productVersion),
MaximumDisplayWidth = Console.BufferWidth
};
var errors = help.RenderParsingErrorsText(this, 2);
if (!string.IsNullOrEmpty(errors))
{
help.AddPreOptionsLine(string.Concat(Environment.NewLine, "ERROR(S):"));
help.AddPreOptionsLine(errors);
}
help.AddPreOptionsLine(" ");
#if !NO_COMMANDLINE
help.AddPreOptionsLine(((AssemblyLicenseAttribute)assembly
.GetCustomAttributes(typeof(AssemblyLicenseAttribute), false)
.Single()).Value.Trim());
#else
help.AddPreOptionsLine(
"This is free software. You may redistribute copies of it under the terms of the MIT License <http://www.opensource.org/licenses/mit-license.php>.");
#endif
help.AddPreOptionsLine(" ");
help.AddPreOptionsLine(string.Format("{0} [options...] \"<targetpath>\"",
Process.GetCurrentProcess().ProcessName));
help.AddOptions(this);
return help.ToString();
}
示例8: HandleParsingErrorsInHelp
private void HandleParsingErrorsInHelp(HelpText help)
{
if (this.LastPostParsingState.Errors.Count > 0)
{
var errors = help.RenderParsingErrorsText(this, 2); // indent with two spaces
if (!string.IsNullOrEmpty(errors))
{
help.AddPreOptionsLine(string.Concat(Environment.NewLine, "ERROR(S):"));
help.AddPreOptionsLine(errors);
}
}
}
示例9: GetUsageError
/// <summary>
/// message of errors
/// </summary>
/// <returns>string of message of errors</returns>
public string GetUsageError()
{
var help = new HelpText();
if (this.LastParserState.Errors.Count > 0)
{
var errors = help.RenderParsingErrorsText(this, 2); // indent with two spaces
if (!string.IsNullOrEmpty(errors))
{
help.AddPreOptionsLine(string.Concat("\n", "Error(s):"));
help.AddPreOptionsLine(errors);
}
}
return help;
}
示例10: GetUsage
public string GetUsage()
{
var help = new HelpText();
if (this.LastParserState.Errors.Any())
{
var errors = help.RenderParsingErrorsText(this, 2); // indent with two spaces
if (!string.IsNullOrEmpty(errors))
{
help.AddPreOptionsLine(string.Concat(Environment.NewLine, "ERROR(S):"));
help.AddPreOptionsLine(errors);
}
}
return help;
}
示例11: GetUsageHelp
public string GetUsageHelp()
{
var help = new HelpText
{
Heading = GetProductName(),
Copyright = GetProductCopyright(),
AddDashesToOption = true,
AdditionalNewLineAfterOption = true,
MaximumDisplayWidth = 75,
};
help.RenderParsingErrorsText(this, 0);
help.AddOptions(this);
return help;
}
示例12: GetUsage
public string GetUsage()
{
var help = new HelpText("GeoIp Example runner", "Copyright 2013", this);
// ...
if (this.LastParserState.Errors.Count > 0)
{
var errors = help.RenderParsingErrorsText(this, 2); // indent with two spaces
if (!string.IsNullOrEmpty(errors))
{
help.AddPreOptionsLine(string.Concat(Environment.NewLine, "ERROR(S):"));
help.AddPreOptionsLine(errors);
}
}
// ...
return help.ToString();
}
示例13: Errors
public string Errors()
{
var help = new HelpText();
if (this.LastPostParsingState.Errors.Count > 0)
{
var errors = help.RenderParsingErrorsText(this, 2);
if (!string.IsNullOrEmpty(errors))
{
help.AddPreOptionsLine(string.Concat(Environment.NewLine, "ERROR(S):"));
help.AddPreOptionsLine(errors);
}
}
return help;
}
示例14: GetUsage
public string GetUsage()
{
var help = new HelpText();
if (Help)
{
help.AddPreOptionsLine("Generate docx document from template and data entity");
help.AddOptions(this);
}
else if (ParserState != null && ParserState.Errors.Any())
{
help.AddPreOptionsLine("ERROR(S):");
help.AddPreOptionsLine(help.RenderParsingErrorsText(this, 2));
help.AddPreOptionsLine("use key -h/--help for help");
}
return help;
}
示例15: GetUsage
public string GetUsage()
{
var help = new HelpText { AddDashesToOption = true };
if (this.LastParserState != null && this.LastParserState.Errors.Any())
{
var errors = help.RenderParsingErrorsText(this, 2); // indent with two spaces
if (!string.IsNullOrEmpty(errors))
{
help.AddPreOptionsLine("ERROR(S):");
help.AddPreOptionsLine(errors);
}
}
help.AddPreOptionsLine("Usage: acbuilder [OPTIONS] assetcatalog");
help.AddOptions(this);
return help;
}