本文整理汇总了C#中CommandLine.Text.HelpText.AddPreOptionsLine方法的典型用法代码示例。如果您正苦于以下问题:C# HelpText.AddPreOptionsLine方法的具体用法?C# HelpText.AddPreOptionsLine怎么用?C# HelpText.AddPreOptionsLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommandLine.Text.HelpText
的用法示例。
在下文中一共展示了HelpText.AddPreOptionsLine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetUsage
public string GetUsage()
{
var help = new HelpText
{
Copyright = new CopyrightInfo("MasterDevs", 2015),
AdditionalNewLineAfterOption = false,
AddDashesToOption = true,
};
help.AddPreOptionsLine("Usage: tidyJson [OPTIONS]");
help.AddPreOptionsLine("Uses standard in and standard out if input or output not supplied");
help.AddPostOptionsLine("Examples:");
help.AddPostOptionsLine(" echo {json:'value'} | tidyJson");
help.AddPostOptionsLine(" Read JSON from standard input and write it to standard output");
help.AddPostOptionsLine(string.Empty);
help.AddPostOptionsLine(" tidyJson -c");
help.AddPostOptionsLine(" Read JSON from clipboard and write it back to the clipboard");
help.AddPostOptionsLine(string.Empty);
help.AddPostOptionsLine(" tidyJson -f myOutput.json");
help.AddPostOptionsLine(" Read JSON from standard input and write it to the file myOutput.json");
help.AddPostOptionsLine(string.Empty);
help.AddPostOptionsLine(" tidyJson -i myInput.json");
help.AddPostOptionsLine(" Read JSON from the file myInput.Json and write it to standard output");
help.AddPostOptionsLine(string.Empty);
help.AddPostOptionsLine(" tidyJson -i myInput.json -f myOutput.json");
help.AddPostOptionsLine(" Read JSON from the file myInput.Json and write it to the file myOutput.json");
help.AddOptions(this);
return help;
//return HelpText.AutoBuild(this,
// (HelpText current) => HelpText.DefaultParsingErrorsHandler(this, current));
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: GetUsage
public string GetUsage(string verb)
{
var help = new HelpText
{
Heading = HeadingInfo.Default,
Copyright = CopyrightInfo.Default,
AdditionalNewLineAfterOption = true,
AddDashesToOption = true
};
object optionsObject = null;
if (verb == DotNetCommandName)
{
help.AddPreOptionsLine(Environment.NewLine + "Usage: ToTypeScriptD dotnet [--specialTypes] [File1.dll]...[FileN.dll]");
optionsObject = new DotNetSubOptions();
}
else if (verb == WinmdCommandName)
{
help.AddPreOptionsLine(Environment.NewLine + "Usage: ToTypeScriptD winmd [--specialTypes] [File1.winmd]...[FileN.winmd]");
optionsObject = new WinmdSubOptions();
}
if (optionsObject != null)
{
help.AddOptions(optionsObject); ;
}
else
{
help.AddDashesToOption = false;
help.AddOptions(this);
}
return help;
}
示例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 help = new HelpText(Program._headingInfo);
help.AdditionalNewLineAfterOption = true;
help.AddPreOptionsLine(string.Format(@"Usage: {0}", Assembly.GetExecutingAssembly().GetName().Name));
help.AddPreOptionsLine(string.Format(@" {0} -c 4 -d 24-3-2010 -t 10", Assembly.GetExecutingAssembly().GetName().Name));
help.AddOptions(this);
return help;
}
示例8: GetUsage
public string GetUsage()
{
HelpText help = new HelpText(_headingInfo);
help.Copyright = new CopyrightInfo("Adam Machanic", 2006);
help.AddPreOptionsLine("Check for updates at: https://github.com/ErikEJ/SqlQueryStress");
help.AddPreOptionsLine("");
help.AddPreOptionsLine("Sample usage:");
help.AddPreOptionsLine("SqlQueryStress -c \"saved.SqlStress\" -u -t 32");
help.AddOptions(this);
return help;
}
示例9: GetUsage
public string GetUsage()
{
var help = new HelpText
{
AddDashesToOption = true
};
help.AddPreOptionsLine("");
help.AddPreOptionsLine($"Usage: {AppDomain.CurrentDomain.FriendlyName} pluginDirectory [options]");
help.AddOptions(this);
return help;
}
示例10: GetUsage
public string GetUsage()
{
var help = new HelpText(new HeadingInfo("MyProgram", "1.0"));
help.Copyright = new CopyrightInfo("Authors, Inc.", 2007);
help.AddPreOptionsLine("This software is under the terms of the XYZ License");
help.AddPreOptionsLine("(http://license-text.org/show.cgi?xyz).");
help.AddPreOptionsLine("Usage: myprog --input equations-file.xml -o result-file.xml");
help.AddPreOptionsLine(" myprog -i equations-file.xml --paralell");
help.AddPreOptionsLine(" myprog -i equations-file.xml -vo result-file.xml");
help.AddOptions(this);
return help;
}
示例11: GetUsage
public string GetUsage()
{
var help = new HelpText( Program._headingInfo );
help.AdditionalNewLineAfterOption = true;
help.Copyright = new CopyrightInfo( "Axiom Engine Team", 2003, 2010 );
help.AddPreOptionsLine( "This is free software. You may redistribute copies of it under the terms of" );
help.AddPreOptionsLine( "the LGPL License <http://www.opensource.org/licenses/lgpl-license.php>." );
help.AddPreOptionsLine( "Usage: SampleApp -sCompositor " );
help.AddOptions( this );
return help;
}
示例12: GetUsage
public string GetUsage()
{
var help = new HelpText {
Heading = new HeadingInfo("BDInfoCli", (Assembly.GetExecutingAssembly().GetName().Version).ToString()),
AdditionalNewLineAfterOption = true,
AddDashesToOption = true
};
help.AddPreOptionsLine("Licensed under LGPL V2.1");
help.AddPreOptionsLine("Usage: BDInfoCli <BD Folder> <Save Path>");
help.AddOptions(this);
return help;
}
示例13: 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);
}
}
}
示例14: GetUsage
public string GetUsage()
{
var help = new HelpText()
{
Heading = new HeadingInfo("Gullap | http://devtyr.com", Assembly.GetExecutingAssembly().GetName().Version.ToString()),
Copyright = new CopyrightInfo("Norbert Eder", 2013),
AddDashesToOption = true
};
help.AddPreOptionsLine(" ");
help.AddPreOptionsLine("Usage: GullapConsole -option value");
help.AddOptions(this);
return help;
}
示例15: GetUsage
public string GetUsage() {
var help = new HelpText {
Heading = $"Foundatio Job Runner v{Program.GetInformationalVersion()}",
AdditionalNewLineAfterOption = false,
AddDashesToOption = true
};
help.AddPreOptionsLine(" ");
help.AddPreOptionsLine("Example usage: job -t \"MyAssembly.MyJobType, MyAssembly\" -c");
help.AddOptions(this);
return help;
}