Skip to content

Commit

Permalink
Docs for @parameter(defaultValueDescription)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkarg committed Oct 2, 2023
1 parent 6e44352 commit b40d770
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
8 changes: 8 additions & 0 deletions docs/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,14 @@ You can specify a different assignment string than = by using the attribute assi

== Custom usage formats

You can override the description for the default value shown in the usage output:

[source,java]
----
@Parameter(names = "--start", defaultValueDescription = "The default value is a random number")
int start = Math.random * 100;
----

JCommander allows you to customize the output of the `JCommander#usage()` method.
You can do this by subclassing `IUsageFormatter` and then calling `JCommander#setUsageFormatter(IUsageFormatter)`.

Expand Down
11 changes: 10 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2019,6 +2019,15 @@ <h2 id="_dynamic_parameters">22. Dynamic parameters</h2>
<h2 id="_custom_usage_formats">23. Custom usage formats</h2>
<div class="sectionbody">
<div class="paragraph">
<p>You can override the description for the default value shown in the usage output:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="prettyprint highlight"><code data-lang="java">@Parameter(names = "--start", defaultValueDescription = "The default value is a random number")
int start = Math.random * 100;</code></pre>
</div>
</div>
<div class="paragraph">
<p>JCommander allows you to customize the output of the <code>JCommander#usage()</code> method.
You can do this by subclassing <code>IUsageFormatter</code> and then calling <code>JCommander#setUsageFormatter(IUsageFormatter)</code>.</p>
</div>
Expand Down Expand Up @@ -2195,7 +2204,7 @@ <h2 id="_download">29. Download</h2>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2023-10-02 12:48:25 UTC
Last updated 2023-10-02 14:50:54 UTC
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
Expand Down

0 comments on commit b40d770

Please sign in to comment.