public void CanPrintUsageRequired() { var writer = new UsageWriter(UsageTarget.Console); string usage = writer.WriteArgUsage("-y", "the message", false, 4); Assert.AreEqual(" -y the message", usage); }
public void CanPrintUsageOptional() { var writer = new UsageWriter(UsageTarget.Console); string usage = writer.WriteArgUsage("-y", "the message", true, 4); Assert.AreEqual(" [-y] the message", usage); }
public void Usage <T>(TextWriter writer) { if (writer == null) { throw new ArgumentNullException(nameof(writer)); } var helperWriter = new UsageWriter(writer); helperWriter.Write(typeof(T), this.Configuration); }
internal bool ParseNoVerb(object options, LinkedList <string> args) { try { this.ParseNoVerbInternal(options, args); return(true); } catch (ParserException) { if (this.Configuration.ErrorOutput != null) { var hlp = new UsageWriter(this.Configuration.ErrorOutput); hlp.Write(options, this.Configuration); return(false); } throw; } }