| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (1.8.0_144) on Wed Dec 11 21:08:56 MST 2019 --> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <title>CommandLine (Apache Log4j Core 2.13.0 API)</title> |
| <meta name="date" content="2019-12-11"> |
| <link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style"> |
| <script type="text/javascript" src="../../../../../../../script.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="CommandLine (Apache Log4j Core 2.13.0 API)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var methods = {"i0":10,"i1":9,"i2":9,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":9,"i17":9,"i18":10,"i19":10,"i20":10,"i21":10,"i22":9,"i23":9,"i24":10,"i25":10,"i26":10,"i27":10,"i28":9,"i29":9,"i30":9,"i31":10,"i32":10,"i33":10}; |
| var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/CommandLine.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li>Prev Class</li> |
| <li><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../../../index.html?org/apache/logging/log4j/core/tools/picocli/CommandLine.html" target="_top">Frames</a></li> |
| <li><a href="CommandLine.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li><a href="#nested.class.summary">Nested</a> | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle">org.apache.logging.log4j.core.tools.picocli</div> |
| <h2 title="Class CommandLine" class="title">Class CommandLine</h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li>org.apache.logging.log4j.core.tools.picocli.CommandLine</li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <hr> |
| <br> |
| <pre>public class <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.133">CommandLine</a> |
| extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre> |
| <div class="block"><p> |
| CommandLine interpreter that uses reflection to initialize an annotated domain object with values obtained from the |
| command line arguments. |
| </p><h2>Example</h2> |
| <pre>import static picocli.CommandLine.*; |
| |
| @Command(header = "Encrypt FILE(s), or standard input, to standard output or to the output file.", |
| version = "v1.2.3") |
| public class Encrypt { |
| |
| @Parameters(type = File.class, description = "Any number of input files") |
| private List<File> files = new ArrayList<File>(); |
| |
| @Option(names = { "-o", "--out" }, description = "Output file (default: print to console)") |
| private File outputFile; |
| |
| @Option(names = { "-v", "--verbose"}, description = "Verbosely list files processed") |
| private boolean verbose; |
| |
| @Option(names = { "-h", "--help", "-?", "-help"}, usageHelp = true, description = "Display this help and exit") |
| private boolean help; |
| |
| @Option(names = { "-V", "--version"}, versionHelp = true, description = "Display version info and exit") |
| private boolean versionHelp; |
| } |
| </pre> |
| <p> |
| Use <code>CommandLine</code> to initialize a domain object as follows: |
| </p><pre> |
| public static void main(String... args) { |
| Encrypt encrypt = new Encrypt(); |
| try { |
| List<CommandLine> parsedCommands = new CommandLine(encrypt).parse(args); |
| if (!CommandLine.printHelpIfRequested(parsedCommands, System.err, Help.Ansi.AUTO)) { |
| runProgram(encrypt); |
| } |
| } catch (ParameterException ex) { // command line arguments could not be parsed |
| System.err.println(ex.getMessage()); |
| ex.getCommandLine().usage(System.err); |
| } |
| } |
| </pre><p> |
| Invoke the above program with some command line arguments. The below are all equivalent: |
| </p> |
| <pre> |
| --verbose --out=outfile in1 in2 |
| --verbose --out outfile in1 in2 |
| -v --out=outfile in1 in2 |
| -v -o outfile in1 in2 |
| -v -o=outfile in1 in2 |
| -vo outfile in1 in2 |
| -vo=outfile in1 in2 |
| -v -ooutfile in1 in2 |
| -vooutfile in1 in2 |
| </pre></div> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ======== NESTED CLASS SUMMARY ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="nested.class.summary"> |
| <!-- --> |
| </a> |
| <h3>Nested Class Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation"> |
| <caption><span>Nested Classes</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Class and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static interface </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html" title="annotation in org.apache.logging.log4j.core.tools.picocli">CommandLine.Command</a></span></code> |
| <div class="block">Annotate your class with <code>@Command</code> when you want more control over the format of the generated help |
| message.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.DefaultExceptionHandler.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.DefaultExceptionHandler</a></span></code> |
| <div class="block">Default exception handler that prints the exception message to the specified <code>PrintStream</code>, followed by the |
| usage message for the command or subcommand whose input was invalid.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.DuplicateOptionAnnotationsException.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.DuplicateOptionAnnotationsException</a></span></code> |
| <div class="block">Exception indicating that multiple fields have been annotated with the same Option name.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.ExecutionException.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.ExecutionException</a></span></code> |
| <div class="block">Exception indicating a problem while invoking a command or subcommand.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.Help</a></span></code> |
| <div class="block">A collection of methods and inner classes that provide fine-grained control over the contents and layout of |
| the usage help message to display to end users when help is requested or invalid input values were specified.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static interface </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.IExceptionHandler.html" title="interface in org.apache.logging.log4j.core.tools.picocli">CommandLine.IExceptionHandler</a></span></code> |
| <div class="block">Represents a function that can handle a <code>ParameterException</code> that occurred while |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parse-java.lang.String...-">parsing</a> the command line arguments.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.InitializationException.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.InitializationException</a></span></code> |
| <div class="block">Exception indicating a problem during <code>CommandLine</code> initialization.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static interface </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.IParseResultHandler.html" title="interface in org.apache.logging.log4j.core.tools.picocli">CommandLine.IParseResultHandler</a></span></code> |
| <div class="block">Represents a function that can process a List of <code>CommandLine</code> objects resulting from successfully |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parse-java.lang.String...-">parsing</a> the command line arguments.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static interface </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.ITypeConverter.html" title="interface in org.apache.logging.log4j.core.tools.picocli">CommandLine.ITypeConverter</a><<a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.ITypeConverter.html" title="type parameter in CommandLine.ITypeConverter">K</a>></span></code> |
| <div class="block"> |
| When parsing command line arguments and initializing |
| fields annotated with <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>@Option</code></a> or <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Parameters.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>@Parameters</code></a>, |
| String values can be converted to any type for which a <code>ITypeConverter</code> is registered.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.MaxValuesforFieldExceededException.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.MaxValuesforFieldExceededException</a></span></code> |
| <div class="block">Exception indicating that more values were specified for an option or parameter than its <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#arity--"><code>arity</code></a> allows.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.MissingParameterException.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.MissingParameterException</a></span></code> |
| <div class="block">Exception indicating that a required parameter was not specified.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.MissingTypeConverterException.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.MissingTypeConverterException</a></span></code> |
| <div class="block">Exception indicating that an annotated field had a type for which no <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.ITypeConverter.html" title="interface in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.ITypeConverter</code></a> was |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#registerConverter-java.lang.Class-org.apache.logging.log4j.core.tools.picocli.CommandLine.ITypeConverter-">registered</a>.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static interface </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html" title="annotation in org.apache.logging.log4j.core.tools.picocli">CommandLine.Option</a></span></code> |
| <div class="block"> |
| Annotate fields in your class with <code>@Option</code> and picocli will initialize these fields when matching |
| arguments are specified on the command line.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.OverwrittenOptionException.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.OverwrittenOptionException</a></span></code> |
| <div class="block">Exception indicating that an option for a single-value option field has been specified multiple times on the command line.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.ParameterException.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.ParameterException</a></span></code> |
| <div class="block">Exception indicating something went wrong while parsing command line options.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.ParameterIndexGapException.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.ParameterIndexGapException</a></span></code> |
| <div class="block">Exception indicating that there was a gap in the indices of the fields annotated with <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Parameters.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Parameters</code></a>.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static interface </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Parameters.html" title="annotation in org.apache.logging.log4j.core.tools.picocli">CommandLine.Parameters</a></span></code> |
| <div class="block"> |
| Fields annotated with <code>@Parameters</code> will be initialized with positional parameters.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.PicocliException.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.PicocliException</a></span></code> |
| <div class="block">Base class of all exceptions thrown by <code>picocli.CommandLine</code>.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Range.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.Range</a></span></code> |
| <div class="block">Describes the number of parameters required and accepted by an option or a positional parameter.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.RunAll.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.RunAll</a></span></code> |
| <div class="block">Command line parse result handler that prints help if requested, and otherwise executes the top-level command and |
| all subcommands as <code>Runnable</code> or <code>Callable</code>.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.RunFirst.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.RunFirst</a></span></code> |
| <div class="block">Command line parse result handler that prints help if requested, and otherwise executes the top-level |
| <code>Runnable</code> or <code>Callable</code> command.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.RunLast.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.RunLast</a></span></code> |
| <div class="block">Command line parse result handler that prints help if requested, and otherwise executes the most specific |
| <code>Runnable</code> or <code>Callable</code> subcommand.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.TypeConversionException.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.TypeConversionException</a></span></code> |
| <div class="block">Exception thrown by <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.ITypeConverter.html" title="interface in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.ITypeConverter</code></a> implementations to indicate a String could not be converted.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.UnmatchedArgumentException.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.UnmatchedArgumentException</a></span></code> |
| <div class="block">Exception indicating that a command line argument could not be mapped to any of the fields annotated with |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Option</code></a> or <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Parameters.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Parameters</code></a>.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- =========== FIELD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="field.summary"> |
| <!-- --> |
| </a> |
| <h3>Field Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation"> |
| <caption><span>Fields</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Field and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#VERSION">VERSION</a></span></code> |
| <div class="block">This is picocli version "2.0.3".</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.summary"> |
| <!-- --> |
| </a> |
| <h3>Constructor Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> |
| <caption><span>Constructors</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colOne" scope="col">Constructor and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colOne"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#CommandLine-java.lang.Object-">CommandLine</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> command)</code> |
| <div class="block">Constructs a new <code>CommandLine</code> interpreter with the specified annotated object.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Method and Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#addSubcommand-java.lang.String-java.lang.Object-">addSubcommand</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> name, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> command)</code> |
| <div class="block">Registers a subcommand with the specified name.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code>static <C extends <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Callable.html?is-external=true" title="class or interface in java.util.concurrent">Callable</a><T>,T><br>T</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#call-C-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-java.lang.String...-">call</a></span>(C callable, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.Ansi.html" title="enum in org.apache.logging.log4j.core.tools.picocli">CommandLine.Help.Ansi</a> ansi, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... args)</code> |
| <div class="block">Convenience method to allow command line application authors to avoid some boilerplate code in their application.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code>static <C extends <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Callable.html?is-external=true" title="class or interface in java.util.concurrent">Callable</a><T>,T><br>T</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#call-C-java.io.PrintStream-java.lang.String...-">call</a></span>(C callable, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... args)</code> |
| <div class="block">Delegates to <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#call-C-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-java.lang.String...-"><code>call(Callable, PrintStream, Help.Ansi, String...)</code></a> with <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.Ansi.html#AUTO"><code>CommandLine.Help.Ansi.AUTO</code></a>.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code><T> T</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#getCommand--">getCommand</a></span>()</code> |
| <div class="block">Returns the annotated object that this <code>CommandLine</code> instance was constructed with.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#getCommandName--">getCommandName</a></span>()</code> |
| <div class="block">Returns the command name (also called program name) displayed in the usage help synopsis.</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#getParent--">getParent</a></span>()</code> |
| <div class="block">Returns the command that this is a subcommand of, or <code>null</code> if this is a top-level command.</div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#getSeparator--">getSeparator</a></span>()</code> |
| <div class="block">Returns the String that separates option names from option values when parsing command line options.</div> |
| </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine</a>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#getSubcommands--">getSubcommands</a></span>()</code> |
| <div class="block">Returns a map with the subcommands <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#addSubcommand-java.lang.String-java.lang.Object-">registered</a> on this instance.</div> |
| </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#getUnmatchedArguments--">getUnmatchedArguments</a></span>()</code> |
| <div class="block">Returns the list of unmatched command line arguments, if any.</div> |
| </td> |
| </tr> |
| <tr id="i9" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#isOverwrittenOptionsAllowed--">isOverwrittenOptionsAllowed</a></span>()</code> |
| <div class="block">Returns whether options for single-value fields can be specified multiple times on the command line.</div> |
| </td> |
| </tr> |
| <tr id="i10" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#isUnmatchedArgumentsAllowed--">isUnmatchedArgumentsAllowed</a></span>()</code> |
| <div class="block">Returns whether the end user may specify arguments on the command line that are not matched to any option or parameter fields.</div> |
| </td> |
| </tr> |
| <tr id="i11" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#isUsageHelpRequested--">isUsageHelpRequested</a></span>()</code> |
| <div class="block">Returns <code>true</code> if an option annotated with <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#usageHelp--"><code>CommandLine.Option.usageHelp()</code></a> was specified on the command line.</div> |
| </td> |
| </tr> |
| <tr id="i12" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#isVersionHelpRequested--">isVersionHelpRequested</a></span>()</code> |
| <div class="block">Returns <code>true</code> if an option annotated with <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#versionHelp--"><code>CommandLine.Option.versionHelp()</code></a> was specified on the command line.</div> |
| </td> |
| </tr> |
| <tr id="i13" class="rowColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine</a>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parse-java.lang.String...-">parse</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... args)</code> |
| <div class="block">Parses the specified command line arguments and returns a list of <code>CommandLine</code> objects representing the |
| top-level command and any subcommands (if any) that were recognized and initialized during the parsing process.</div> |
| </td> |
| </tr> |
| <tr id="i14" class="altColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parseWithHandler-org.apache.logging.log4j.core.tools.picocli.CommandLine.IParseResultHandler-java.io.PrintStream-java.lang.String...-">parseWithHandler</a></span>(<a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.IParseResultHandler.html" title="interface in org.apache.logging.log4j.core.tools.picocli">CommandLine.IParseResultHandler</a> handler, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... args)</code> |
| <div class="block">Returns the result of calling <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parseWithHandlers-org.apache.logging.log4j.core.tools.picocli.CommandLine.IParseResultHandler-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-org.apache.logging.log4j.core.tools.picocli.CommandLine.IExceptionHandler-java.lang.String...-"><code>parseWithHandlers(IParseResultHandler, PrintStream, Help.Ansi, IExceptionHandler, String...)</code></a> |
| with <code>Help.Ansi.AUTO</code> and a new <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.DefaultExceptionHandler.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.DefaultExceptionHandler</code></a> in addition to the specified parse result handler, |
| <code>PrintStream</code>, and the specified command line arguments.</div> |
| </td> |
| </tr> |
| <tr id="i15" class="rowColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parseWithHandlers-org.apache.logging.log4j.core.tools.picocli.CommandLine.IParseResultHandler-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-org.apache.logging.log4j.core.tools.picocli.CommandLine.IExceptionHandler-java.lang.String...-">parseWithHandlers</a></span>(<a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.IParseResultHandler.html" title="interface in org.apache.logging.log4j.core.tools.picocli">CommandLine.IParseResultHandler</a> handler, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.Ansi.html" title="enum in org.apache.logging.log4j.core.tools.picocli">CommandLine.Help.Ansi</a> ansi, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.IExceptionHandler.html" title="interface in org.apache.logging.log4j.core.tools.picocli">CommandLine.IExceptionHandler</a> exceptionHandler, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... args)</code> |
| <div class="block">Tries to <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parse-java.lang.String...-">parse</a> the specified command line arguments, and if successful, delegates |
| the processing of the resulting list of <code>CommandLine</code> objects to the specified <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.IParseResultHandler.html" title="interface in org.apache.logging.log4j.core.tools.picocli">handler</a>.</div> |
| </td> |
| </tr> |
| <tr id="i16" class="altColor"> |
| <td class="colFirst"><code>static <T> T</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#populateCommand-T-java.lang.String...-">populateCommand</a></span>(T command, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... args)</code> |
| <div class="block"> |
| Convenience method that initializes the specified annotated object from the specified command line arguments.</div> |
| </td> |
| </tr> |
| <tr id="i17" class="rowColor"> |
| <td class="colFirst"><code>static boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#printHelpIfRequested-java.util.List-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-">printHelpIfRequested</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine</a>> parsedCommands, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.Ansi.html" title="enum in org.apache.logging.log4j.core.tools.picocli">CommandLine.Help.Ansi</a> ansi)</code> |
| <div class="block">Helper method that may be useful when processing the list of <code>CommandLine</code> objects that result from successfully |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parse-java.lang.String...-">parsing</a> command line arguments.</div> |
| </td> |
| </tr> |
| <tr id="i18" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#printVersionHelp-java.io.PrintStream-">printVersionHelp</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out)</code> |
| <div class="block">Delegates to <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#printVersionHelp-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-"><code>printVersionHelp(PrintStream, Help.Ansi)</code></a> with the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.Ansi.html#AUTO">platform default</a>.</div> |
| </td> |
| </tr> |
| <tr id="i19" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#printVersionHelp-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-">printVersionHelp</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.Ansi.html" title="enum in org.apache.logging.log4j.core.tools.picocli">CommandLine.Help.Ansi</a> ansi)</code> |
| <div class="block">Prints version information from the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html#version--"><code>CommandLine.Command.version()</code></a> annotation to the specified <code>PrintStream</code>.</div> |
| </td> |
| </tr> |
| <tr id="i20" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#printVersionHelp-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-java.lang.Object...-">printVersionHelp</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.Ansi.html" title="enum in org.apache.logging.log4j.core.tools.picocli">CommandLine.Help.Ansi</a> ansi, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>... params)</code> |
| <div class="block">Prints version information from the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html#version--"><code>CommandLine.Command.version()</code></a> annotation to the specified <code>PrintStream</code>.</div> |
| </td> |
| </tr> |
| <tr id="i21" class="rowColor"> |
| <td class="colFirst"><code><K> <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#registerConverter-java.lang.Class-org.apache.logging.log4j.core.tools.picocli.CommandLine.ITypeConverter-">registerConverter</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a><K> cls, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.ITypeConverter.html" title="interface in org.apache.logging.log4j.core.tools.picocli">CommandLine.ITypeConverter</a><K> converter)</code> |
| <div class="block">Registers the specified type converter for the specified class.</div> |
| </td> |
| </tr> |
| <tr id="i22" class="altColor"> |
| <td class="colFirst"><code>static <R extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Runnable.html?is-external=true" title="class or interface in java.lang">Runnable</a>><br>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#run-R-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-java.lang.String...-">run</a></span>(R runnable, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.Ansi.html" title="enum in org.apache.logging.log4j.core.tools.picocli">CommandLine.Help.Ansi</a> ansi, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... args)</code> |
| <div class="block">Convenience method to allow command line application authors to avoid some boilerplate code in their application.</div> |
| </td> |
| </tr> |
| <tr id="i23" class="rowColor"> |
| <td class="colFirst"><code>static <R extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Runnable.html?is-external=true" title="class or interface in java.lang">Runnable</a>><br>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#run-R-java.io.PrintStream-java.lang.String...-">run</a></span>(R runnable, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... args)</code> |
| <div class="block">Delegates to <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#run-R-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-java.lang.String...-"><code>run(Runnable, PrintStream, Help.Ansi, String...)</code></a> with <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.Ansi.html#AUTO"><code>CommandLine.Help.Ansi.AUTO</code></a>.</div> |
| </td> |
| </tr> |
| <tr id="i24" class="altColor"> |
| <td class="colFirst"><code><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#setCommandName-java.lang.String-">setCommandName</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> commandName)</code> |
| <div class="block">Sets the command name (also called program name) displayed in the usage help synopsis to the specified value.</div> |
| </td> |
| </tr> |
| <tr id="i25" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#setOverwrittenOptionsAllowed-boolean-">setOverwrittenOptionsAllowed</a></span>(boolean newValue)</code> |
| <div class="block">Sets whether options for single-value fields can be specified multiple times on the command line without a <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.OverwrittenOptionException.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.OverwrittenOptionException</code></a> being thrown.</div> |
| </td> |
| </tr> |
| <tr id="i26" class="altColor"> |
| <td class="colFirst"><code><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#setSeparator-java.lang.String-">setSeparator</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> separator)</code> |
| <div class="block">Sets the String the parser uses to separate option names from option values to the specified value.</div> |
| </td> |
| </tr> |
| <tr id="i27" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#setUnmatchedArgumentsAllowed-boolean-">setUnmatchedArgumentsAllowed</a></span>(boolean newValue)</code> |
| <div class="block">Sets whether the end user may specify unmatched arguments on the command line without a <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.UnmatchedArgumentException.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.UnmatchedArgumentException</code></a> being thrown.</div> |
| </td> |
| </tr> |
| <tr id="i28" class="altColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#usage-java.lang.Object-java.io.PrintStream-">usage</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> command, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out)</code> |
| <div class="block">Equivalent to <code>new CommandLine(command).usage(out)</code>.</div> |
| </td> |
| </tr> |
| <tr id="i29" class="rowColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#usage-java.lang.Object-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-">usage</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> command, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.Ansi.html" title="enum in org.apache.logging.log4j.core.tools.picocli">CommandLine.Help.Ansi</a> ansi)</code> |
| <div class="block">Equivalent to <code>new CommandLine(command).usage(out, ansi)</code>.</div> |
| </td> |
| </tr> |
| <tr id="i30" class="altColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#usage-java.lang.Object-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.ColorScheme-">usage</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> command, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.ColorScheme.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.Help.ColorScheme</a> colorScheme)</code> |
| <div class="block">Equivalent to <code>new CommandLine(command).usage(out, colorScheme)</code>.</div> |
| </td> |
| </tr> |
| <tr id="i31" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#usage-java.io.PrintStream-">usage</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out)</code> |
| <div class="block">Delegates to <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#usage-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-"><code>usage(PrintStream, Help.Ansi)</code></a> with the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.Ansi.html#AUTO">platform default</a>.</div> |
| </td> |
| </tr> |
| <tr id="i32" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#usage-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-">usage</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.Ansi.html" title="enum in org.apache.logging.log4j.core.tools.picocli">CommandLine.Help.Ansi</a> ansi)</code> |
| <div class="block">Delegates to <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#usage-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.ColorScheme-"><code>usage(PrintStream, Help.ColorScheme)</code></a> with the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.html#defaultColorScheme-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-">default color scheme</a>.</div> |
| </td> |
| </tr> |
| <tr id="i33" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#usage-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.ColorScheme-">usage</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.ColorScheme.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.Help.ColorScheme</a> colorScheme)</code> |
| <div class="block">Prints a usage help message for the annotated command class to the specified <code>PrintStream</code>.</div> |
| </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3> |
| <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ FIELD DETAIL =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="field.detail"> |
| <!-- --> |
| </a> |
| <h3>Field Detail</h3> |
| <a name="VERSION"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>VERSION</h4> |
| <pre>public static final <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.135">VERSION</a></pre> |
| <div class="block">This is picocli version "2.0.3".</div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../../../constant-values.html#org.apache.logging.log4j.core.tools.picocli.CommandLine.VERSION">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.detail"> |
| <!-- --> |
| </a> |
| <h3>Constructor Detail</h3> |
| <a name="CommandLine-java.lang.Object-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>CommandLine</h4> |
| <pre>public <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.155">CommandLine</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> command)</pre> |
| <div class="block">Constructs a new <code>CommandLine</code> interpreter with the specified annotated object. |
| When the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parse-java.lang.String...-"><code>parse(String...)</code></a> method is called, fields of the specified object that are annotated |
| with <code>@Option</code> or <code>@Parameters</code> will be initialized based on command line arguments.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>command</code> - the object to initialize from the command line arguments</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.InitializationException.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.InitializationException</a></code> - if the specified command object does not have a <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Command</code></a>, <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Option</code></a> or <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Parameters.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Parameters</code></a> annotation</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a name="addSubcommand-java.lang.String-java.lang.Object-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>addSubcommand</h4> |
| <pre>public <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine</a> <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.200">addSubcommand</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> name, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> command)</pre> |
| <div class="block">Registers a subcommand with the specified name. For example: |
| <pre> |
| CommandLine commandLine = new CommandLine(new Git()) |
| .addSubcommand("status", new GitStatus()) |
| .addSubcommand("commit", new GitCommit(); |
| .addSubcommand("add", new GitAdd()) |
| .addSubcommand("branch", new GitBranch()) |
| .addSubcommand("checkout", new GitCheckout()) |
| //... |
| ; |
| </pre> |
| |
| <p>The specified object can be an annotated object or a |
| <code>CommandLine</code> instance with its own nested subcommands. For example:</p> |
| <pre> |
| CommandLine commandLine = new CommandLine(new MainCommand()) |
| .addSubcommand("cmd1", new ChildCommand1()) // subcommand |
| .addSubcommand("cmd2", new ChildCommand2()) |
| .addSubcommand("cmd3", new CommandLine(new ChildCommand3()) // subcommand with nested sub-subcommands |
| .addSubcommand("cmd3sub1", new GrandChild3Command1()) |
| .addSubcommand("cmd3sub2", new GrandChild3Command2()) |
| .addSubcommand("cmd3sub3", new CommandLine(new GrandChild3Command3()) // deeper nesting |
| .addSubcommand("cmd3sub3sub1", new GreatGrandChild3Command3_1()) |
| .addSubcommand("cmd3sub3sub2", new GreatGrandChild3Command3_2()) |
| ) |
| ); |
| </pre> |
| <p>The default type converters are available on all subcommands and nested sub-subcommands, but custom type |
| converters are registered only with the subcommand hierarchy as it existed when the custom type was registered. |
| To ensure a custom type converter is available to all subcommands, register the type converter last, after |
| adding subcommands.</p> |
| <p>See also the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html#subcommands--"><code>CommandLine.Command.subcommands()</code></a> annotation to register subcommands declaratively.</p></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>name</code> - the string to recognize on the command line as a subcommand</dd> |
| <dd><code>command</code> - the object to initialize with command line arguments following the subcommand name. |
| This may be a <code>CommandLine</code> instance with its own (nested) subcommands</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this CommandLine object, to allow method chaining</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>0.9.7</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#registerConverter-java.lang.Class-org.apache.logging.log4j.core.tools.picocli.CommandLine.ITypeConverter-"><code>registerConverter(Class, ITypeConverter)</code></a>, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html#subcommands--"><code>CommandLine.Command.subcommands()</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getSubcommands--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getSubcommands</h4> |
| <pre>public <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine</a>> <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.210">getSubcommands</a>()</pre> |
| <div class="block">Returns a map with the subcommands <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#addSubcommand-java.lang.String-java.lang.Object-">registered</a> on this instance.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a map with the registered subcommands</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>0.9.7</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getParent--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getParent</h4> |
| <pre>public <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine</a> <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.220">getParent</a>()</pre> |
| <div class="block">Returns the command that this is a subcommand of, or <code>null</code> if this is a top-level command.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the command that this is a subcommand of, or <code>null</code> if this is a top-level command</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>0.9.8</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#addSubcommand-java.lang.String-java.lang.Object-"><code>addSubcommand(String, Object)</code></a>, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html#subcommands--"><code>CommandLine.Command.subcommands()</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getCommand--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getCommand</h4> |
| <pre>public <T> T <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.229">getCommand</a>()</pre> |
| <div class="block">Returns the annotated object that this <code>CommandLine</code> instance was constructed with.</div> |
| <dl> |
| <dt><span class="paramLabel">Type Parameters:</span></dt> |
| <dd><code>T</code> - the type of the variable that the return value is being assigned to</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the annotated object that this <code>CommandLine</code> instance was constructed with</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>0.9.7</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="isUsageHelpRequested--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isUsageHelpRequested</h4> |
| <pre>public boolean <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.236">isUsageHelpRequested</a>()</pre> |
| <div class="block">Returns <code>true</code> if an option annotated with <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#usageHelp--"><code>CommandLine.Option.usageHelp()</code></a> was specified on the command line.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>whether the parser encountered an option annotated with <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#usageHelp--"><code>CommandLine.Option.usageHelp()</code></a>.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>0.9.8</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="isVersionHelpRequested--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isVersionHelpRequested</h4> |
| <pre>public boolean <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.241">isVersionHelpRequested</a>()</pre> |
| <div class="block">Returns <code>true</code> if an option annotated with <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#versionHelp--"><code>CommandLine.Option.versionHelp()</code></a> was specified on the command line.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>whether the parser encountered an option annotated with <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#versionHelp--"><code>CommandLine.Option.versionHelp()</code></a>.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>0.9.8</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="isOverwrittenOptionsAllowed--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isOverwrittenOptionsAllowed</h4> |
| <pre>public boolean <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.249">isOverwrittenOptionsAllowed</a>()</pre> |
| <div class="block">Returns whether options for single-value fields can be specified multiple times on the command line. |
| The default is <code>false</code> and a <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.OverwrittenOptionException.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.OverwrittenOptionException</code></a> is thrown if this happens. |
| When <code>true</code>, the last specified value is retained.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>true</code> if options for single-value fields can be specified multiple times on the command line, <code>false</code> otherwise</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>0.9.7</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setOverwrittenOptionsAllowed-boolean-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setOverwrittenOptionsAllowed</h4> |
| <pre>public <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine</a> <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.262">setOverwrittenOptionsAllowed</a>(boolean newValue)</pre> |
| <div class="block">Sets whether options for single-value fields can be specified multiple times on the command line without a <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.OverwrittenOptionException.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.OverwrittenOptionException</code></a> being thrown. |
| <p>The specified setting will be registered with this <code>CommandLine</code> and the full hierarchy of its |
| subcommands and nested sub-subcommands <em>at the moment this method is called</em>. Subcommands added |
| later will have the default setting. To ensure a setting is applied to all |
| subcommands, call the setter last, after adding subcommands.</p></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>newValue</code> - the new setting</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this <code>CommandLine</code> object, to allow method chaining</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>0.9.7</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="isUnmatchedArgumentsAllowed--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isUnmatchedArgumentsAllowed</h4> |
| <pre>public boolean <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.277">isUnmatchedArgumentsAllowed</a>()</pre> |
| <div class="block">Returns whether the end user may specify arguments on the command line that are not matched to any option or parameter fields. |
| The default is <code>false</code> and a <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.UnmatchedArgumentException.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.UnmatchedArgumentException</code></a> is thrown if this happens. |
| When <code>true</code>, the last unmatched arguments are available via the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#getUnmatchedArguments--"><code>getUnmatchedArguments()</code></a> method.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>true</code> if the end use may specify unmatched arguments on the command line, <code>false</code> otherwise</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>0.9.7</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#getUnmatchedArguments--"><code>getUnmatchedArguments()</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setUnmatchedArgumentsAllowed-boolean-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setUnmatchedArgumentsAllowed</h4> |
| <pre>public <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine</a> <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.291">setUnmatchedArgumentsAllowed</a>(boolean newValue)</pre> |
| <div class="block">Sets whether the end user may specify unmatched arguments on the command line without a <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.UnmatchedArgumentException.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.UnmatchedArgumentException</code></a> being thrown. |
| <p>The specified setting will be registered with this <code>CommandLine</code> and the full hierarchy of its |
| subcommands and nested sub-subcommands <em>at the moment this method is called</em>. Subcommands added |
| later will have the default setting. To ensure a setting is applied to all |
| subcommands, call the setter last, after adding subcommands.</p></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>newValue</code> - the new setting. When <code>true</code>, the last unmatched arguments are available via the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#getUnmatchedArguments--"><code>getUnmatchedArguments()</code></a> method.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this <code>CommandLine</code> object, to allow method chaining</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>0.9.7</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#getUnmatchedArguments--"><code>getUnmatchedArguments()</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getUnmatchedArguments--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getUnmatchedArguments</h4> |
| <pre>public <a href="https://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>> <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.304">getUnmatchedArguments</a>()</pre> |
| <div class="block">Returns the list of unmatched command line arguments, if any.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the list of unmatched command line arguments or an empty list</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>0.9.7</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#isUnmatchedArgumentsAllowed--"><code>isUnmatchedArgumentsAllowed()</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="populateCommand-java.lang.Object-java.lang.String:A-"> |
| <!-- --> |
| </a><a name="populateCommand-T-java.lang.String...-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>populateCommand</h4> |
| <pre>public static <T> T <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.328">populateCommand</a>(T command, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... args)</pre> |
| <div class="block"><p> |
| Convenience method that initializes the specified annotated object from the specified command line arguments. |
| </p><p> |
| This is equivalent to |
| </p><pre> |
| CommandLine cli = new CommandLine(command); |
| cli.parse(args); |
| return command; |
| </pre></div> |
| <dl> |
| <dt><span class="paramLabel">Type Parameters:</span></dt> |
| <dd><code>T</code> - the type of the annotated object</dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>command</code> - the object to initialize. This object contains fields annotated with |
| <code>@Option</code> or <code>@Parameters</code>.</dd> |
| <dd><code>args</code> - the command line arguments to parse</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the specified annotated object</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.InitializationException.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.InitializationException</a></code> - if the specified command object does not have a <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Command</code></a>, <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Option</code></a> or <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Parameters.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Parameters</code></a> annotation</dd> |
| <dd><code><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.ParameterException.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.ParameterException</a></code> - if the specified command line arguments are invalid</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>0.9.7</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="parse-java.lang.String...-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>parse</h4> |
| <pre>public <a href="https://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine</a>> <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.348">parse</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... args)</pre> |
| <div class="block">Parses the specified command line arguments and returns a list of <code>CommandLine</code> objects representing the |
| top-level command and any subcommands (if any) that were recognized and initialized during the parsing process. |
| <p> |
| If parsing succeeds, the first element in the returned list is always <code>this CommandLine</code> object. The |
| returned list may contain more elements if subcommands were <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#addSubcommand-java.lang.String-java.lang.Object-">registered</a> |
| and these subcommands were initialized by matching command line arguments. If parsing fails, a |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.ParameterException.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.ParameterException</code></a> is thrown. |
| </p></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>args</code> - the command line arguments to parse</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a list with the top-level command and any subcommands initialized by this method</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.ParameterException.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.ParameterException</a></code> - if the specified command line arguments are invalid; use |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.ParameterException.html#getCommandLine--"><code>CommandLine.ParameterException.getCommandLine()</code></a> to get the command or subcommand whose user input was invalid</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="printHelpIfRequested-java.util.List-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>printHelpIfRequested</h4> |
| <pre>public static boolean <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.432">printHelpIfRequested</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine</a>> parsedCommands, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.Ansi.html" title="enum in org.apache.logging.log4j.core.tools.picocli">CommandLine.Help.Ansi</a> ansi)</pre> |
| <div class="block">Helper method that may be useful when processing the list of <code>CommandLine</code> objects that result from successfully |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parse-java.lang.String...-">parsing</a> command line arguments. This method prints out |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#usage-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-">usage help</a> if <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#isUsageHelpRequested--">requested</a> |
| or <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#printVersionHelp-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-">version help</a> if <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#isVersionHelpRequested--">requested</a> |
| and returns <code>true</code>. Otherwise, if none of the specified <code>CommandLine</code> objects have help requested, |
| this method returns <code>false</code>. |
| <p> |
| Note that this method <em>only</em> looks at the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#usageHelp--"><code>usageHelp</code></a> and |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#versionHelp--"><code>versionHelp</code></a> attributes. The <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#help--"><code>help</code></a> attribute is ignored. |
| </p></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>parsedCommands</code> - the list of <code>CommandLine</code> objects to check if help was requested</dd> |
| <dd><code>out</code> - the <code>PrintStream</code> to print help to if requested</dd> |
| <dd><code>ansi</code> - for printing help messages using ANSI styles and colors</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>true</code> if help was printed, <code>false</code> otherwise</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="parseWithHandler-org.apache.logging.log4j.core.tools.picocli.CommandLine.IParseResultHandler-java.io.PrintStream-java.lang.String...-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>parseWithHandler</h4> |
| <pre>public <a href="https://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>> <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.610">parseWithHandler</a>(<a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.IParseResultHandler.html" title="interface in org.apache.logging.log4j.core.tools.picocli">CommandLine.IParseResultHandler</a> handler, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... args)</pre> |
| <div class="block">Returns the result of calling <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parseWithHandlers-org.apache.logging.log4j.core.tools.picocli.CommandLine.IParseResultHandler-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-org.apache.logging.log4j.core.tools.picocli.CommandLine.IExceptionHandler-java.lang.String...-"><code>parseWithHandlers(IParseResultHandler, PrintStream, Help.Ansi, IExceptionHandler, String...)</code></a> |
| with <code>Help.Ansi.AUTO</code> and a new <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.DefaultExceptionHandler.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.DefaultExceptionHandler</code></a> in addition to the specified parse result handler, |
| <code>PrintStream</code>, and the specified command line arguments. |
| <p> |
| This is a convenience method intended to offer the same ease of use as the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#run-R-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-java.lang.String...-"><code>run</code></a> |
| and <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#call-C-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-java.lang.String...-"><code>call</code></a> methods, but with more flexibility and better |
| support for nested subcommands. |
| </p> |
| <p>Calling this method roughly expands to:</p> |
| <pre> |
| try { |
| List<CommandLine> parsedCommands = parse(args); |
| return parseResultsHandler.handleParseResult(parsedCommands, out, Help.Ansi.AUTO); |
| } catch (ParameterException ex) { |
| return new DefaultExceptionHandler().handleException(ex, out, ansi, args); |
| } |
| </pre> |
| <p> |
| Picocli provides some default handlers that allow you to accomplish some common tasks with very little code. |
| The following handlers are available:</p> |
| <ul> |
| <li><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.RunLast.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.RunLast</code></a> handler prints help if requested, and otherwise gets the last specified command or subcommand |
| and tries to execute it as a <code>Runnable</code> or <code>Callable</code>.</li> |
| <li><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.RunFirst.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.RunFirst</code></a> handler prints help if requested, and otherwise executes the top-level command as a <code>Runnable</code> or <code>Callable</code>.</li> |
| <li><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.RunAll.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.RunAll</code></a> handler prints help if requested, and otherwise executes all recognized commands and subcommands as <code>Runnable</code> or <code>Callable</code> tasks.</li> |
| <li><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.DefaultExceptionHandler.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.DefaultExceptionHandler</code></a> prints the error message followed by usage help</li> |
| </ul></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>handler</code> - the function that will process the result of successfully parsing the command line arguments</dd> |
| <dd><code>out</code> - the <code>PrintStream</code> to print help to if requested</dd> |
| <dd><code>args</code> - the command line arguments</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a list of results, or an empty list if there are no results</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.ExecutionException.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.ExecutionException</a></code> - if the command line arguments were parsed successfully but a problem occurred while processing the |
| parse results; use <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.ExecutionException.html#getCommandLine--"><code>CommandLine.ExecutionException.getCommandLine()</code></a> to get the command or subcommand where processing failed</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.0</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.RunLast.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.RunLast</code></a>, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.RunAll.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.RunAll</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="parseWithHandlers-org.apache.logging.log4j.core.tools.picocli.CommandLine.IParseResultHandler-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-org.apache.logging.log4j.core.tools.picocli.CommandLine.IExceptionHandler-java.lang.String...-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>parseWithHandlers</h4> |
| <pre>public <a href="https://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>> <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.655">parseWithHandlers</a>(<a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.IParseResultHandler.html" title="interface in org.apache.logging.log4j.core.tools.picocli">CommandLine.IParseResultHandler</a> handler, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.Ansi.html" title="enum in org.apache.logging.log4j.core.tools.picocli">CommandLine.Help.Ansi</a> ansi, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.IExceptionHandler.html" title="interface in org.apache.logging.log4j.core.tools.picocli">CommandLine.IExceptionHandler</a> exceptionHandler, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... args)</pre> |
| <div class="block">Tries to <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parse-java.lang.String...-">parse</a> the specified command line arguments, and if successful, delegates |
| the processing of the resulting list of <code>CommandLine</code> objects to the specified <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.IParseResultHandler.html" title="interface in org.apache.logging.log4j.core.tools.picocli">handler</a>. |
| If the command line arguments were invalid, the <code>ParameterException</code> thrown from the <code>parse</code> method |
| is caught and passed to the specified <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.IExceptionHandler.html" title="interface in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.IExceptionHandler</code></a>. |
| <p> |
| This is a convenience method intended to offer the same ease of use as the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#run-R-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-java.lang.String...-"><code>run</code></a> |
| and <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#call-C-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-java.lang.String...-"><code>call</code></a> methods, but with more flexibility and better |
| support for nested subcommands. |
| </p> |
| <p>Calling this method roughly expands to:</p> |
| <pre> |
| try { |
| List<CommandLine> parsedCommands = parse(args); |
| return parseResultsHandler.handleParseResult(parsedCommands, out, ansi); |
| } catch (ParameterException ex) { |
| return new exceptionHandler.handleException(ex, out, ansi, args); |
| } |
| </pre> |
| <p> |
| Picocli provides some default handlers that allow you to accomplish some common tasks with very little code. |
| The following handlers are available:</p> |
| <ul> |
| <li><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.RunLast.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.RunLast</code></a> handler prints help if requested, and otherwise gets the last specified command or subcommand |
| and tries to execute it as a <code>Runnable</code> or <code>Callable</code>.</li> |
| <li><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.RunFirst.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.RunFirst</code></a> handler prints help if requested, and otherwise executes the top-level command as a <code>Runnable</code> or <code>Callable</code>.</li> |
| <li><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.RunAll.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.RunAll</code></a> handler prints help if requested, and otherwise executes all recognized commands and subcommands as <code>Runnable</code> or <code>Callable</code> tasks.</li> |
| <li><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.DefaultExceptionHandler.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.DefaultExceptionHandler</code></a> prints the error message followed by usage help</li> |
| </ul></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>handler</code> - the function that will process the result of successfully parsing the command line arguments</dd> |
| <dd><code>out</code> - the <code>PrintStream</code> to print help to if requested</dd> |
| <dd><code>ansi</code> - for printing help messages using ANSI styles and colors</dd> |
| <dd><code>exceptionHandler</code> - the function that can handle the <code>ParameterException</code> thrown when the command line arguments are invalid</dd> |
| <dd><code>args</code> - the command line arguments</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a list of results produced by the <code>IParseResultHandler</code> or the <code>IExceptionHandler</code>, or an empty list if there are no results</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.ExecutionException.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.ExecutionException</a></code> - if the command line arguments were parsed successfully but a problem occurred while processing the parse |
| result <code>CommandLine</code> objects; use <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.ExecutionException.html#getCommandLine--"><code>CommandLine.ExecutionException.getCommandLine()</code></a> to get the command or subcommand where processing failed</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.0</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.RunLast.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.RunLast</code></a>, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.RunAll.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.RunAll</code></a>, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.DefaultExceptionHandler.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.DefaultExceptionHandler</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="usage-java.lang.Object-java.io.PrintStream-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>usage</h4> |
| <pre>public static void <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.669">usage</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> command, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out)</pre> |
| <div class="block">Equivalent to <code>new CommandLine(command).usage(out)</code>. See <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#usage-java.io.PrintStream-"><code>usage(PrintStream)</code></a> for details.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>command</code> - the object annotated with <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Command</code></a>, <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Option</code></a> and <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Parameters.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Parameters</code></a></dd> |
| <dd><code>out</code> - the print stream to print the help message to</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the specified command object does not have a <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Command</code></a>, <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Option</code></a> or <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Parameters.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Parameters</code></a> annotation</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="usage-java.lang.Object-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>usage</h4> |
| <pre>public static void <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.681">usage</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> command, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.Ansi.html" title="enum in org.apache.logging.log4j.core.tools.picocli">CommandLine.Help.Ansi</a> ansi)</pre> |
| <div class="block">Equivalent to <code>new CommandLine(command).usage(out, ansi)</code>. |
| See <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#usage-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-"><code>usage(PrintStream, Help.Ansi)</code></a> for details.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>command</code> - the object annotated with <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Command</code></a>, <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Option</code></a> and <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Parameters.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Parameters</code></a></dd> |
| <dd><code>out</code> - the print stream to print the help message to</dd> |
| <dd><code>ansi</code> - whether the usage message should contain ANSI escape codes or not</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the specified command object does not have a <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Command</code></a>, <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Option</code></a> or <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Parameters.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Parameters</code></a> annotation</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="usage-java.lang.Object-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.ColorScheme-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>usage</h4> |
| <pre>public static void <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.693">usage</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> command, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.ColorScheme.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.Help.ColorScheme</a> colorScheme)</pre> |
| <div class="block">Equivalent to <code>new CommandLine(command).usage(out, colorScheme)</code>. |
| See <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#usage-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.ColorScheme-"><code>usage(PrintStream, Help.ColorScheme)</code></a> for details.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>command</code> - the object annotated with <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Command</code></a>, <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Option</code></a> and <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Parameters.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Parameters</code></a></dd> |
| <dd><code>out</code> - the print stream to print the help message to</dd> |
| <dd><code>colorScheme</code> - the <code>ColorScheme</code> defining the styles for options, parameters and commands when ANSI is enabled</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the specified command object does not have a <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Command</code></a>, <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Option</code></a> or <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Parameters.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Parameters</code></a> annotation</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="usage-java.io.PrintStream-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>usage</h4> |
| <pre>public void <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.702">usage</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out)</pre> |
| <div class="block">Delegates to <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#usage-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-"><code>usage(PrintStream, Help.Ansi)</code></a> with the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.Ansi.html#AUTO">platform default</a>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>out</code> - the printStream to print to</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#usage-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.ColorScheme-"><code>usage(PrintStream, Help.ColorScheme)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="usage-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>usage</h4> |
| <pre>public void <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.712">usage</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.Ansi.html" title="enum in org.apache.logging.log4j.core.tools.picocli">CommandLine.Help.Ansi</a> ansi)</pre> |
| <div class="block">Delegates to <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#usage-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.ColorScheme-"><code>usage(PrintStream, Help.ColorScheme)</code></a> with the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.html#defaultColorScheme-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-">default color scheme</a>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>out</code> - the printStream to print to</dd> |
| <dd><code>ansi</code> - whether the usage message should include ANSI escape codes or not</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#usage-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.ColorScheme-"><code>usage(PrintStream, Help.ColorScheme)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="usage-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.ColorScheme-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>usage</h4> |
| <pre>public void <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.747">usage</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.ColorScheme.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.Help.ColorScheme</a> colorScheme)</pre> |
| <div class="block">Prints a usage help message for the annotated command class to the specified <code>PrintStream</code>. |
| Delegates construction of the usage help message to the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Help</code></a> inner class and is equivalent to: |
| <pre> |
| Help help = new Help(command).addAllSubcommands(getSubcommands()); |
| StringBuilder sb = new StringBuilder() |
| .append(help.headerHeading()) |
| .append(help.header()) |
| .append(help.synopsisHeading()) //e.g. Usage: |
| .append(help.synopsis()) //e.g. <main class> [OPTIONS] <command> [COMMAND-OPTIONS] [ARGUMENTS] |
| .append(help.descriptionHeading()) //e.g. %nDescription:%n%n |
| .append(help.description()) //e.g. {"Converts foos to bars.", "Use options to control conversion mode."} |
| .append(help.parameterListHeading()) //e.g. %nPositional parameters:%n%n |
| .append(help.parameterList()) //e.g. [FILE...] the files to convert |
| .append(help.optionListHeading()) //e.g. %nOptions:%n%n |
| .append(help.optionList()) //e.g. -h, --help displays this help and exits |
| .append(help.commandListHeading()) //e.g. %nCommands:%n%n |
| .append(help.commandList()) //e.g. add adds the frup to the frooble |
| .append(help.footerHeading()) |
| .append(help.footer()); |
| out.print(sb); |
| </pre> |
| <p>Annotate your class with <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Command</code></a> to control many aspects of the usage help message, including |
| the program name, text of section headings and section contents, and some aspects of the auto-generated sections |
| of the usage help message. |
| <p>To customize the auto-generated sections of the usage help message, like how option details are displayed, |
| instantiate a <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Help</code></a> object and use a <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.TextTable.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Help.TextTable</code></a> with more of fewer columns, a custom |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.Layout.html" title="class in org.apache.logging.log4j.core.tools.picocli">layout</a>, and/or a custom option <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.IOptionRenderer.html" title="interface in org.apache.logging.log4j.core.tools.picocli">renderer</a> |
| for ultimate control over which aspects of an Option or Field are displayed where.</p></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>out</code> - the <code>PrintStream</code> to print the usage help message to</dd> |
| <dd><code>colorScheme</code> - the <code>ColorScheme</code> defining the styles for options, parameters and commands when ANSI is enabled</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="printVersionHelp-java.io.PrintStream-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>printVersionHelp</h4> |
| <pre>public void <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.780">printVersionHelp</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out)</pre> |
| <div class="block">Delegates to <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#printVersionHelp-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-"><code>printVersionHelp(PrintStream, Help.Ansi)</code></a> with the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.Ansi.html#AUTO">platform default</a>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>out</code> - the printStream to print to</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>0.9.8</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#printVersionHelp-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-"><code>printVersionHelp(PrintStream, Help.Ansi)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="printVersionHelp-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>printVersionHelp</h4> |
| <pre>public void <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.793">printVersionHelp</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.Ansi.html" title="enum in org.apache.logging.log4j.core.tools.picocli">CommandLine.Help.Ansi</a> ansi)</pre> |
| <div class="block">Prints version information from the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html#version--"><code>CommandLine.Command.version()</code></a> annotation to the specified <code>PrintStream</code>. |
| Each element of the array of version strings is printed on a separate line. Version strings may contain |
| <a href="http://picocli.info/#_usage_help_with_styles_and_colors">markup for colors and style</a>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>out</code> - the printStream to print to</dd> |
| <dd><code>ansi</code> - whether the usage message should include ANSI escape codes or not</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>0.9.8</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html#version--"><code>CommandLine.Command.version()</code></a>, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#versionHelp--"><code>CommandLine.Option.versionHelp()</code></a>, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#isVersionHelpRequested--"><code>isVersionHelpRequested()</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="printVersionHelp-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-java.lang.Object...-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>printVersionHelp</h4> |
| <pre>public void <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.811">printVersionHelp</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.Ansi.html" title="enum in org.apache.logging.log4j.core.tools.picocli">CommandLine.Help.Ansi</a> ansi, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>... params)</pre> |
| <div class="block">Prints version information from the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html#version--"><code>CommandLine.Command.version()</code></a> annotation to the specified <code>PrintStream</code>. |
| Each element of the array of version strings is <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true#format-java.lang.String-java.lang.Object...-" title="class or interface in java.lang">formatted</a> with the |
| specified parameters, and printed on a separate line. Both version strings and parameters may contain |
| <a href="http://picocli.info/#_usage_help_with_styles_and_colors">markup for colors and style</a>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>out</code> - the printStream to print to</dd> |
| <dd><code>ansi</code> - whether the usage message should include ANSI escape codes or not</dd> |
| <dd><code>params</code> - Arguments referenced by the format specifiers in the version strings</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>1.0.0</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html#version--"><code>CommandLine.Command.version()</code></a>, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html#versionHelp--"><code>CommandLine.Option.versionHelp()</code></a>, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#isVersionHelpRequested--"><code>isVersionHelpRequested()</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="call-java.util.concurrent.Callable-java.io.PrintStream-java.lang.String:A-"> |
| <!-- --> |
| </a><a name="call-C-java.io.PrintStream-java.lang.String...-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>call</h4> |
| <pre>public static <C extends <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Callable.html?is-external=true" title="class or interface in java.util.concurrent">Callable</a><T>,T> T <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.835">call</a>(C callable, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... args)</pre> |
| <div class="block">Delegates to <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#call-C-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-java.lang.String...-"><code>call(Callable, PrintStream, Help.Ansi, String...)</code></a> with <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.Ansi.html#AUTO"><code>CommandLine.Help.Ansi.AUTO</code></a>. |
| <p> |
| From picocli v2.0, this method prints usage help or version help if <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#printHelpIfRequested-java.util.List-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-">requested</a>, |
| and any exceptions thrown by the <code>Callable</code> are caught and rethrown wrapped in an <code>ExecutionException</code>. |
| </p></div> |
| <dl> |
| <dt><span class="paramLabel">Type Parameters:</span></dt> |
| <dd><code>C</code> - the annotated object must implement Callable</dd> |
| <dd><code>T</code> - the return type of the most specific command (must implement <code>Callable</code>)</dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>callable</code> - the command to call when <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parse-java.lang.String...-">parsing</a> succeeds.</dd> |
| <dd><code>out</code> - the printStream to print to</dd> |
| <dd><code>args</code> - the command line arguments to parse</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>null</code> if an error occurred while parsing the command line options, otherwise returns the result of calling the Callable</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.InitializationException.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.InitializationException</a></code> - if the specified command object does not have a <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Command</code></a>, <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Option</code></a> or <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Parameters.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Parameters</code></a> annotation</dd> |
| <dd><code><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.ExecutionException.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.ExecutionException</a></code> - if the Callable throws an exception</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#call-C-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-java.lang.String...-"><code>call(Callable, PrintStream, Help.Ansi, String...)</code></a>, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parseWithHandlers-org.apache.logging.log4j.core.tools.picocli.CommandLine.IParseResultHandler-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-org.apache.logging.log4j.core.tools.picocli.CommandLine.IExceptionHandler-java.lang.String...-"><code>parseWithHandlers(IParseResultHandler, PrintStream, Help.Ansi, IExceptionHandler, String...)</code></a>, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.RunFirst.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.RunFirst</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="call-java.util.concurrent.Callable-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-java.lang.String:A-"> |
| <!-- --> |
| </a><a name="call-C-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-java.lang.String...-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>call</h4> |
| <pre>public static <C extends <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Callable.html?is-external=true" title="class or interface in java.util.concurrent">Callable</a><T>,T> T <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.883">call</a>(C callable, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.Ansi.html" title="enum in org.apache.logging.log4j.core.tools.picocli">CommandLine.Help.Ansi</a> ansi, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... args)</pre> |
| <div class="block">Convenience method to allow command line application authors to avoid some boilerplate code in their application. |
| The annotated object needs to implement <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Callable.html?is-external=true" title="class or interface in java.util.concurrent"><code>Callable</code></a>. Calling this method is equivalent to: |
| <pre> |
| CommandLine cmd = new CommandLine(callable); |
| List<CommandLine> parsedCommands; |
| try { |
| parsedCommands = cmd.parse(args); |
| } catch (ParameterException ex) { |
| out.println(ex.getMessage()); |
| cmd.usage(out, ansi); |
| return null; |
| } |
| if (CommandLine.printHelpIfRequested(parsedCommands, out, ansi)) { |
| return null; |
| } |
| CommandLine last = parsedCommands.get(parsedCommands.size() - 1); |
| try { |
| Callable<Object> subcommand = last.getCommand(); |
| return subcommand.call(); |
| } catch (Exception ex) { |
| throw new ExecutionException(last, "Error calling " + last.getCommand(), ex); |
| } |
| </pre> |
| <p> |
| If the specified Callable command has subcommands, the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.RunLast.html" title="class in org.apache.logging.log4j.core.tools.picocli">last</a> subcommand specified on the |
| command line is executed. |
| Commands with subcommands may be interested in calling the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parseWithHandler-org.apache.logging.log4j.core.tools.picocli.CommandLine.IParseResultHandler-java.io.PrintStream-java.lang.String...-"><code>parseWithHandler</code></a> |
| method with a <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.RunAll.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.RunAll</code></a> handler or a custom handler. |
| </p><p> |
| From picocli v2.0, this method prints usage help or version help if <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#printHelpIfRequested-java.util.List-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-">requested</a>, |
| and any exceptions thrown by the <code>Callable</code> are caught and rethrown wrapped in an <code>ExecutionException</code>. |
| </p></div> |
| <dl> |
| <dt><span class="paramLabel">Type Parameters:</span></dt> |
| <dd><code>C</code> - the annotated object must implement Callable</dd> |
| <dd><code>T</code> - the return type of the specified <code>Callable</code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>callable</code> - the command to call when <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parse-java.lang.String...-">parsing</a> succeeds.</dd> |
| <dd><code>out</code> - the printStream to print to</dd> |
| <dd><code>ansi</code> - whether the usage message should include ANSI escape codes or not</dd> |
| <dd><code>args</code> - the command line arguments to parse</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>null</code> if an error occurred while parsing the command line options, or if help was requested and printed. Otherwise returns the result of calling the Callable</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.InitializationException.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.InitializationException</a></code> - if the specified command object does not have a <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Command</code></a>, <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Option</code></a> or <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Parameters.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Parameters</code></a> annotation</dd> |
| <dd><code><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.ExecutionException.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.ExecutionException</a></code> - if the Callable throws an exception</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parseWithHandlers-org.apache.logging.log4j.core.tools.picocli.CommandLine.IParseResultHandler-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-org.apache.logging.log4j.core.tools.picocli.CommandLine.IExceptionHandler-java.lang.String...-"><code>parseWithHandlers(IParseResultHandler, PrintStream, Help.Ansi, IExceptionHandler, String...)</code></a>, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.RunLast.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.RunLast</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="run-java.lang.Runnable-java.io.PrintStream-java.lang.String:A-"> |
| <!-- --> |
| </a><a name="run-R-java.io.PrintStream-java.lang.String...-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>run</h4> |
| <pre>public static <R extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Runnable.html?is-external=true" title="class or interface in java.lang">Runnable</a>> void <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.905">run</a>(R runnable, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... args)</pre> |
| <div class="block">Delegates to <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#run-R-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-java.lang.String...-"><code>run(Runnable, PrintStream, Help.Ansi, String...)</code></a> with <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.Ansi.html#AUTO"><code>CommandLine.Help.Ansi.AUTO</code></a>. |
| <p> |
| From picocli v2.0, this method prints usage help or version help if <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#printHelpIfRequested-java.util.List-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-">requested</a>, |
| and any exceptions thrown by the <code>Runnable</code> are caught and rethrown wrapped in an <code>ExecutionException</code>. |
| </p></div> |
| <dl> |
| <dt><span class="paramLabel">Type Parameters:</span></dt> |
| <dd><code>R</code> - the annotated object must implement Runnable</dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>runnable</code> - the command to run when <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parse-java.lang.String...-">parsing</a> succeeds.</dd> |
| <dd><code>out</code> - the printStream to print to</dd> |
| <dd><code>args</code> - the command line arguments to parse</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.InitializationException.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.InitializationException</a></code> - if the specified command object does not have a <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Command</code></a>, <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Option</code></a> or <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Parameters.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Parameters</code></a> annotation</dd> |
| <dd><code><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.ExecutionException.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.ExecutionException</a></code> - if the Runnable throws an exception</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#run-R-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-java.lang.String...-"><code>run(Runnable, PrintStream, Help.Ansi, String...)</code></a>, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parseWithHandlers-org.apache.logging.log4j.core.tools.picocli.CommandLine.IParseResultHandler-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-org.apache.logging.log4j.core.tools.picocli.CommandLine.IExceptionHandler-java.lang.String...-"><code>parseWithHandlers(IParseResultHandler, PrintStream, Help.Ansi, IExceptionHandler, String...)</code></a>, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.RunFirst.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.RunFirst</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="run-java.lang.Runnable-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-java.lang.String:A-"> |
| <!-- --> |
| </a><a name="run-R-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-java.lang.String...-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>run</h4> |
| <pre>public static <R extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Runnable.html?is-external=true" title="class or interface in java.lang">Runnable</a>> void <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.951">run</a>(R runnable, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html?is-external=true" title="class or interface in java.io">PrintStream</a> out, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Help.Ansi.html" title="enum in org.apache.logging.log4j.core.tools.picocli">CommandLine.Help.Ansi</a> ansi, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... args)</pre> |
| <div class="block">Convenience method to allow command line application authors to avoid some boilerplate code in their application. |
| The annotated object needs to implement <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Runnable.html?is-external=true" title="class or interface in java.lang"><code>Runnable</code></a>. Calling this method is equivalent to: |
| <pre> |
| CommandLine cmd = new CommandLine(runnable); |
| List<CommandLine> parsedCommands; |
| try { |
| parsedCommands = cmd.parse(args); |
| } catch (ParameterException ex) { |
| out.println(ex.getMessage()); |
| cmd.usage(out, ansi); |
| return null; |
| } |
| if (CommandLine.printHelpIfRequested(parsedCommands, out, ansi)) { |
| return null; |
| } |
| CommandLine last = parsedCommands.get(parsedCommands.size() - 1); |
| try { |
| Runnable subcommand = last.getCommand(); |
| subcommand.run(); |
| } catch (Exception ex) { |
| throw new ExecutionException(last, "Error running " + last.getCommand(), ex); |
| } |
| </pre> |
| <p> |
| If the specified Runnable command has subcommands, the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.RunLast.html" title="class in org.apache.logging.log4j.core.tools.picocli">last</a> subcommand specified on the |
| command line is executed. |
| Commands with subcommands may be interested in calling the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parseWithHandler-org.apache.logging.log4j.core.tools.picocli.CommandLine.IParseResultHandler-java.io.PrintStream-java.lang.String...-"><code>parseWithHandler</code></a> |
| method with a <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.RunAll.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.RunAll</code></a> handler or a custom handler. |
| </p><p> |
| From picocli v2.0, this method prints usage help or version help if <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#printHelpIfRequested-java.util.List-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-">requested</a>, |
| and any exceptions thrown by the <code>Runnable</code> are caught and rethrown wrapped in an <code>ExecutionException</code>. |
| </p></div> |
| <dl> |
| <dt><span class="paramLabel">Type Parameters:</span></dt> |
| <dd><code>R</code> - the annotated object must implement Runnable</dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>runnable</code> - the command to run when <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parse-java.lang.String...-">parsing</a> succeeds.</dd> |
| <dd><code>out</code> - the printStream to print to</dd> |
| <dd><code>ansi</code> - whether the usage message should include ANSI escape codes or not</dd> |
| <dd><code>args</code> - the command line arguments to parse</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.InitializationException.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.InitializationException</a></code> - if the specified command object does not have a <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Command</code></a>, <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Option</code></a> or <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Parameters.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Parameters</code></a> annotation</dd> |
| <dd><code><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.ExecutionException.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine.ExecutionException</a></code> - if the Runnable throws an exception</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#parseWithHandlers-org.apache.logging.log4j.core.tools.picocli.CommandLine.IParseResultHandler-java.io.PrintStream-org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi-org.apache.logging.log4j.core.tools.picocli.CommandLine.IExceptionHandler-java.lang.String...-"><code>parseWithHandlers(IParseResultHandler, PrintStream, Help.Ansi, IExceptionHandler, String...)</code></a>, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.RunLast.html" title="class in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.RunLast</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="registerConverter-java.lang.Class-org.apache.logging.log4j.core.tools.picocli.CommandLine.ITypeConverter-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>registerConverter</h4> |
| <pre>public <K> <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine</a> <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.999">registerConverter</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a><K> cls, |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.ITypeConverter.html" title="interface in org.apache.logging.log4j.core.tools.picocli">CommandLine.ITypeConverter</a><K> converter)</pre> |
| <div class="block">Registers the specified type converter for the specified class. When initializing fields annotated with |
| <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Option.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><code>CommandLine.Option</code></a>, the field's type is used as a lookup key to find the associated type converter, and this |
| type converter converts the original command line argument string value to the correct type. |
| <p> |
| Java 8 lambdas make it easy to register custom type converters: |
| </p> |
| <pre> |
| commandLine.registerConverter(java.nio.file.Path.class, s -> java.nio.file.Paths.get(s)); |
| commandLine.registerConverter(java.time.Duration.class, s -> java.time.Duration.parse(s));</pre> |
| <p> |
| Built-in type converters are pre-registered for the following java 1.5 types: |
| </p> |
| <ul> |
| <li>all primitive types</li> |
| <li>all primitive wrapper types: Boolean, Byte, Character, Double, Float, Integer, Long, Short</li> |
| <li>any enum</li> |
| <li>java.io.File</li> |
| <li>java.math.BigDecimal</li> |
| <li>java.math.BigInteger</li> |
| <li>java.net.InetAddress</li> |
| <li>java.net.URI</li> |
| <li>java.net.URL</li> |
| <li>java.nio.charset.Charset</li> |
| <li>java.sql.Time</li> |
| <li>java.util.Date</li> |
| <li>java.util.UUID</li> |
| <li>java.util.regex.Pattern</li> |
| <li>StringBuilder</li> |
| <li>CharSequence</li> |
| <li>String</li> |
| </ul> |
| <p>The specified converter will be registered with this <code>CommandLine</code> and the full hierarchy of its |
| subcommands and nested sub-subcommands <em>at the moment the converter is registered</em>. Subcommands added |
| later will not have this converter added automatically. To ensure a custom type converter is available to all |
| subcommands, register the type converter last, after adding subcommands.</p></div> |
| <dl> |
| <dt><span class="paramLabel">Type Parameters:</span></dt> |
| <dd><code>K</code> - the target type</dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>cls</code> - the target class to convert parameter string values to</dd> |
| <dd><code>converter</code> - the class capable of converting string values to the specified target type</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this CommandLine object, to allow method chaining</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html#addSubcommand-java.lang.String-java.lang.Object-"><code>addSubcommand(String, Object)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getSeparator--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getSeparator</h4> |
| <pre>public <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.1009">getSeparator</a>()</pre> |
| <div class="block">Returns the String that separates option names from option values when parsing command line options. by default.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the String the parser uses to separate option names from option values</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setSeparator-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setSeparator</h4> |
| <pre>public <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine</a> <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.1017">setSeparator</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> separator)</pre> |
| <div class="block">Sets the String the parser uses to separate option names from option values to the specified value. |
| The separator may also be set declaratively with the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html#separator--"><code>CommandLine.Command.separator()</code></a> annotation attribute.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>separator</code> - the String that separates option names from option values</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this <code>CommandLine</code> object, to allow method chaining</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getCommandName--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getCommandName</h4> |
| <pre>public <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.1024">getCommandName</a>()</pre> |
| <div class="block">Returns the command name (also called program name) displayed in the usage help synopsis. by default.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the command name (also called program name) displayed in the usage</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setCommandName-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>setCommandName</h4> |
| <pre>public <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.html" title="class in org.apache.logging.log4j.core.tools.picocli">CommandLine</a> <a href="../../../../../../../src-html/org/apache/logging/log4j/core/tools/picocli/CommandLine.html#line.1033">setCommandName</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> commandName)</pre> |
| <div class="block">Sets the command name (also called program name) displayed in the usage help synopsis to the specified value. |
| Note that this method only modifies the usage help message, it does not impact parsing behaviour. |
| The command name may also be set declaratively with the <a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html#name--"><code>CommandLine.Command.name()</code></a> annotation attribute.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>commandName</code> - command name (also called program name) displayed in the usage help synopsis</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this <code>CommandLine</code> object, to allow method chaining</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/CommandLine.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li>Prev Class</li> |
| <li><a href="../../../../../../../org/apache/logging/log4j/core/tools/picocli/CommandLine.Command.html" title="annotation in org.apache.logging.log4j.core.tools.picocli"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../../../index.html?org/apache/logging/log4j/core/tools/picocli/CommandLine.html" target="_top">Frames</a></li> |
| <li><a href="CommandLine.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li><a href="#nested.class.summary">Nested</a> | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| <p class="legalCopy"><small><p align="center">Copyright © 1999-2019 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.<br /> Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.</p></small></p> |
| </body> |
| </html> |