diff options
author | Cedric Beust <cedric@beust.com> | 2017-03-05 06:42:40 -0800 |
---|---|---|
committer | Cedric Beust <cedric@beust.com> | 2017-03-05 06:42:40 -0800 |
commit | cc5a8e341e7ac9df6b7dcd05519d8ac9f44dedeb (patch) | |
tree | cbb700f17d3070598fe35998aee2257537f3b7d5 /src/main/java/com/beust/jcommander/JCommander.java | |
parent | 0dc65959b1ed71f36e5b2d7ed0e44e2791a5fee8 (diff) | |
parent | 483e219f79d21d5ad7b256650525ac773f479c68 (diff) | |
download | jcommander-cc5a8e341e7ac9df6b7dcd05519d8ac9f44dedeb.tar.gz |
Merge branch 'master' of github.com:cbeust/jcommander
Diffstat (limited to 'src/main/java/com/beust/jcommander/JCommander.java')
-rw-r--r-- | src/main/java/com/beust/jcommander/JCommander.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/main/java/com/beust/jcommander/JCommander.java b/src/main/java/com/beust/jcommander/JCommander.java index 1736ef5..9656ab0 100644 --- a/src/main/java/com/beust/jcommander/JCommander.java +++ b/src/main/java/com/beust/jcommander/JCommander.java @@ -888,6 +888,13 @@ public class JCommander { } /** + * Get the program name (used only in the usage). + */ + public String getProgramName(){ + return programName == null ? null : programName.getName(); + } + + /** * Set the program name * * @param name program name @@ -993,7 +1000,7 @@ public class JCommander { * Adds the provided arg object to the set of objects that this commander * will parse arguments into. * - * @param object The arg object expected to contain {@link Parameter} + * @param o The arg object expected to contain {@link Parameter} * annotations. If <code>object</code> is an array or is {@link Iterable}, * the child objects will be added instead. */ @@ -1050,7 +1057,7 @@ public class JCommander { /** * Adds a factory to lookup string converters. The added factory is used prior to previously added factories. - * @param converterFactory the factory determining string converters + * @param factory the factory determining string converters */ public Builder addConverterFactory(IStringConverterFactory factory) { jCommander.addConverterFactory(factory); @@ -1194,7 +1201,7 @@ public class JCommander { // If commands were specified, show them as well // if (hasCommands) { - out.append(" Commands:\n"); + out.append(indent + " Commands:\n"); // The magic value 3 is the number of spaces between the name of the option // and its description for (Map.Entry<ProgramName, JCommander> commands : this.commands.entrySet()) { @@ -1210,7 +1217,7 @@ public class JCommander { // Options for this command JCommander jc = findCommandByAlias(progName.getName()); - jc.usage(out, " "); + jc.usage(out, indent + " "); out.append("\n"); } } |