public static string GetHeader() { var helpText = new HelpText(HelpText) { AdditionalNewLineAfterOption = false, AddDashesToOption = true }; AddLinesToHelpText(helpText, GeneralUsage); return helpText; }
public string GetUsage() { var help = new HelpText(desc); help.AdditionalNewLineAfterOption = true; help.AddOptions(this); return help; }
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; }
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; }
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; }
private static void Main(string[] args) { try { var options = new Options(); if (!Parser.Default.ParseArguments(args, options)) { var helpText = new HelpText("Laan SolutionConverter", Assembly.GetEntryAssembly().GetName().Version.ToString()); helpText.AddOptions(options); Console.WriteLine(helpText.ToString()); return; } switch (options.Mode) { case Mode.Xml: ConvertToXml(options); break; case Mode.Sln: ConvertToSln(options); break; } } catch (Exception exception) { Console.WriteLine(exception); } }
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; }
public string GetUsage() { string processname = Process.GetCurrentProcess().ProcessName; var help = new HelpText { AdditionalNewLineAfterOption = false, AddDashesToOption = true, Copyright = new CopyrightInfo("Geoffrey Huntley <*****@*****.**>", 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; }
public string GetUsage() { var help = new HelpText("Machine Javascript Bundler"); help.AddPreOptionsLine(@"Example: jsbundler -b path\to\scripts path\to\scripts\folder1 path\to\scripts\folder2 \path\to\scripts\folder3"); help.AddOptions(this); return help; }
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)); }
public string GetUsage() { HelpText help = new HelpText(@"Machine.Migrations"); help.Copyright = new CopyrightInfo("Machine Project", 2007, 2008, 2009); help.AddOptions(this); return help; }
public string GetUsage() { var help = new HelpText(new HeadingInfo("BottomShelf Host", Assembly.GetExecutingAssembly().GetName().Version.ToString(2))); help.Copyright = new CopyrightInfo("Peasant Coder Foundation", DateTime.Now.Year); help.AddOptions(this); return help.ToString(); }
public string GetUsage() { HelpText help = new HelpText(); help.AdditionalNewLineAfterOption = true; //help.Copyright = new CopyrightInfo("locrmap", 2009, 2012); help.AddOptions(this); return help; }
public string GetUsage() { var help = new HelpText { AdditionalNewLineAfterOption = true }; var execName = Assembly.GetExecutingAssembly().GetName().Name + ".exe"; help.AddPreOptionsLine(string.Format("Usage: {0} -c {{command}} -a http://admin:[email protected]:5984/yourdb [-d .\\designDocuments] [-u user1 -p passw0rd]", execName)); help.AddOptions(this); return help; }
public string GetUsage() { HelpText help = new HelpText(eMailServer.HeadingInfo); help.AdditionalNewLineAfterOption = true; help.Copyright = new CopyrightInfo("Ringo Leese", 2013, 2013); help.AddOptions(this); return help; }
public HelpText GetHeader() { HelpText header = new HelpText(Properties.Resources.RadegastTitle); header.AdditionalNewLineAfterOption = true; header.Copyright = new CopyrightInfo("Radegast Development Team", 2009, 2011); header.AddPreOptionsLine("http://radegast.org/"); return header; }
private void HandleParsingErrorsInHelp(HelpText help) { string errors = help.RenderParsingErrorsText(this); if (!string.IsNullOrEmpty(errors)) { help.AddPreOptionsLine(string.Concat(Environment.NewLine, "ERROR: ", errors, Environment.NewLine)); } }
public string GetUsage() { var help = new HelpText("Windows S3 Uploader"); help.Copyright = new CopyrightInfo("Palomino Labs, Inc.", 2012); help.AddPreOptionsLine("Command options:"); help.AddOptions(this); help.AddPostOptionsLine("Omit accessKey and secretKey to get credentials from IAM"); return help; }
public string GetUsage() { var help = new HelpText { }; help.AddOptions(this); return help; }
public string GetUsage() { HelpText text = new HelpText(" "); text.AddPreOptionsLine(" Usage: SlimNet.ConsoleHost.exe -p14000 -a\"C:\\path\\to\\assemblies\\\""); text.AddOptions(this); return text.ToString(); }
public string GetUsage() { var help = new HelpText(_headingInfo); help.AdditionalNewLineAfterOption = true; help.AddPreOptionsLine(Assembly.GetExecutingAssembly().GetResourceText("qcat.usage.txt")); help.AddOptions(this); return help; }
public string GetUsage() { var help = new HelpText("Usage Instructions:"); help.AdditionalNewLineAfterOption = true; help.AddPreOptionsLine("This is free, open source software under the the MIT License <http://www.opensource.org/licenses/mit-license.php>."); help.AddOptions(this); return help; }
public string GetHelp() { var help = new HelpText(" Benutzung: xpatch xmlDatei xpath-Ausdruck [neuerwert] [parameter]" + "\n\nWird kein neuer Wert angegeben, fordert xpatch zur " + "Eingabe des gewünschten Wertes auf." + "\n\nWeitere Parameter:"); help.AddOptions(this); return help; }
public HelpText create_helptext(string heading_info) { var help = new HelpText(heading_info) { AdditionalNewLineAfterOption = true, Copyright = new CopyrightInfo("beta-1.cn/nsnail([email protected])", 2012) }; return help; }
public string GetUsage() { var help = new HelpText { AddDashesToOption = true, Heading = "Usage: GeneralizedMaximumFlow [OPTIONS]", }; help.AddPostOptionsLine("詳しくは ReadMe.md を参照.\n"); help.AddOptions(this); return help; }
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); } } }
public string GetUsage() { var helpText = new HelpText("Giles Options") { AdditionalNewLineAfterOption = true }; helpText.AddOptions(this); return helpText; }
public string GetUsage() { var help = new HelpText("Usage:"); help.AddPreOptionsLine("Ex: SharpMigrations -a MyAssembly.dll -m auto -v 10 -> Migrates to version 10 (no prompt)"); help.AddPreOptionsLine("Ex: SharpMigrations -a MyAssembly.dll -m script -f script.sql -v 10 -> Generates scripts from current version to version 10 into script.sql file"); help.AddPreOptionsLine("Ex: SharpMigrations -a MyAssembly.dll -m script -v 10 -g superplugin -> Generates scripts from current version to version 10 using migration group 'superplugin'"); help.AddPreOptionsLine("Ex: SharpMigrations -a MyAssembly.dll -m seed -s myseed -> Run seed named myseed"); help.AddOptions(this); return help.ToString(); }
public string GetUsage() { Version version = Assembly.GetExecutingAssembly().GetName().Version; var heading = new HeadingInfo(ApplicationName, version.Major + "." + version.Minor); var help = new HelpText(heading); help.Copyright = new CopyrightInfo(true, "Lars Corneliussen, Faktum Software GmbH", 2010); help.AddOptions(this); return help; }
public string GetUsage() { var help = new HelpText { AdditionalNewLineAfterOption = true, AddDashesToOption = true }; help.AddOptions(this); return help; }
/// <summary> /// Creates a new instance of the <see cref="CommandLine.Text.HelpText"/> class using common defaults. /// </summary> /// <returns> /// An instance of <see cref="CommandLine.Text.HelpText"/> class. /// </returns> /// <param name='parserResult'>The <see cref="CommandLine.ParserResult{T}"/> containing the instance that collected command line arguments parsed with <see cref="CommandLine.Parser"/> class.</param> /// <param name='onError'>A delegate used to customize the text block of reporting parsing errors text block.</param> /// <param name='onExample'>A delegate used to customize <see cref="CommandLine.Text.Example"/> model used to render text block of usage examples.</param> /// <param name="verbsIndex">If true the output style is consistent with verb commands (no dashes), otherwise it outputs options.</param> /// <param name="maxDisplayWidth">The maximum width of the display.</param> /// <remarks>The parameter <paramref name="verbsIndex"/> is not ontly a metter of formatting, it controls whether to handle verbs or options.</remarks> public static HelpText AutoBuild <T>( ParserResult <T> parserResult, Func <HelpText, HelpText> onError, Func <Example, Example> onExample, bool verbsIndex = false, int maxDisplayWidth = DefaultMaximumLength) { var auto = new HelpText { Heading = HeadingInfo.Empty, Copyright = CopyrightInfo.Empty, AdditionalNewLineAfterOption = true, AddDashesToOption = !verbsIndex, MaximumDisplayWidth = maxDisplayWidth }; try { auto.Heading = HeadingInfo.Default; auto.Copyright = CopyrightInfo.Default; } catch (Exception) { auto = onError(auto); } var errors = Enumerable.Empty <Error>(); if (onError != null && parserResult.Tag == ParserResultType.NotParsed) { errors = ((NotParsed <T>)parserResult).Errors; if (errors.OnlyMeaningfulOnes().Any()) { auto = onError(auto); } } ReflectionHelper.GetAttribute <AssemblyLicenseAttribute>() .Do(license => license.AddToHelpText(auto, true)); var usageAttr = ReflectionHelper.GetAttribute <AssemblyUsageAttribute>(); var usageLines = HelpText.RenderUsageTextAsLines(parserResult, onExample).ToMaybe(); if (usageAttr.IsJust() || usageLines.IsJust()) { var heading = auto.SentenceBuilder.UsageHeadingText(); if (heading.Length > 0) { auto.AddPreOptionsLine(heading); } } usageAttr.Do( usage => usage.AddToHelpText(auto, true)); usageLines.Do( lines => auto.AddPreOptionsLines(lines)); if ((verbsIndex && parserResult.TypeInfo.Choices.Any()) || errors.Any(e => e.Tag == ErrorType.NoVerbSelectedError)) { auto.AddDashesToOption = false; auto.AddVerbs(parserResult.TypeInfo.Choices.ToArray()); } else { auto.AddOptions(parserResult); } return(auto); }
/// <summary> /// Supplies a default parsing error handler implementation. /// </summary> /// <param name='parserResult'>The <see cref="CommandLine.ParserResult{T}"/> containing the instance that collected command line arguments parsed with <see cref="CommandLine.Parser"/> class.</param> /// <param name="current">The <see cref="CommandLine.Text.HelpText"/> instance.</param> public static HelpText DefaultParsingErrorsHandler<T>(ParserResult<T> parserResult, HelpText current) { if (parserResult == null) throw new ArgumentNullException("parserResult"); if (current == null) throw new ArgumentNullException("current"); if (((NotParsed<T>)parserResult).Errors.OnlyMeaningfulOnes().Empty()) return current; var errors = RenderParsingErrorsTextAsLines(parserResult, current.SentenceBuilder.FormatError, current.SentenceBuilder.FormatMutuallyExclusiveSetErrors, 2); // indent with two spaces if (errors.Empty()) return current; return current .AddPreOptionsLine( string.Concat(Environment.NewLine, current.SentenceBuilder.ErrorsHeadingText())) .AddPreOptionsLines(errors); }
/// <summary> /// Supplies a default parsing error handler implementation. /// </summary> /// <param name='parserResult'>The <see cref="CommandLine.ParserResult{T}"/> containing the instance that collected command line arguments parsed with <see cref="CommandLine.Parser"/> class.</param> /// <param name="current">The <see cref="CommandLine.Text.HelpText"/> instance.</param> public static HelpText DefaultParsingErrorsHandler <T>(ParserResult <T> parserResult, HelpText current) { if (parserResult == null) { throw new ArgumentNullException("parserResult"); } if (current == null) { throw new ArgumentNullException("current"); } if (FilterMeaningfulErrors(parserResult.Errors).Empty()) { return(current); } var errors = HelpText.RenderParsingErrorsText(parserResult, current.SentenceBuilder.FormatError, 2); // indent with two spaces if (string.IsNullOrEmpty(errors)) { return(current); } current.AddPreOptionsLine(string.Concat(Environment.NewLine, current.SentenceBuilder.ErrorsHeadingText())); var lines = errors.Split(new[] { Environment.NewLine }, StringSplitOptions.None); foreach (var line in lines) { current.AddPreOptionsLine(line); } return(current); }