Skip to content

Commit

Permalink
Moved description of defaultValueDescription to usage chapter
Browse files Browse the repository at this point in the history
  • Loading branch information
mkarg committed Oct 2, 2023
1 parent b40d770 commit 1fb1e86
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
17 changes: 9 additions & 8 deletions docs/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,15 @@ class Parameters {
private boolean b;
----

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;
----


== Hiding parameters

If you don't want certain parameters to appear in the usage, you can mark them as "hidden":
Expand Down Expand Up @@ -1049,14 +1058,6 @@ 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
20 changes: 10 additions & 10 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1914,6 +1914,15 @@ <h2 id="_usage">18. Usage</h2>
private boolean b;</code></pre>
</div>
</div>
<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>
</div>
<div class="sect1">
Expand Down Expand Up @@ -2019,15 +2028,6 @@ <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 @@ -2204,7 +2204,7 @@ <h2 id="_download">29. Download</h2>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2023-10-02 14:50:54 UTC
Last updated 2023-10-02 15:11:56 UTC
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
Expand Down

0 comments on commit 1fb1e86

Please sign in to comment.