4545 </subsection >
4646 <subsection name =" Create the Options" >
4747 <p >
48- An <a href =" apidocs /org/apache/commons/cli/Options.html" >
48+ An <a href =" api-1.1 /org/apache/commons/cli/Options.html" >
4949 Options</a > object must be created and the <code >Option</code > must be
5050 added to it.
5151 </p >
@@ -78,7 +78,7 @@ CommandLine cmd = parser.parse( options, args);</source>
7878 <p >
7979 Now we need to check if the <code >t</code > option is present. To do
8080 this we will interrogate the
81- <a href =" apidocs /org/apache/commons/cli/CommandLine.html" >CommandLine
81+ <a href =" api-1.1 /org/apache/commons/cli/CommandLine.html" >CommandLine
8282 </a > object. The <code >hasOption</code > method takes a
8383 <code >java.lang.String</code > parameter and returns <code >true</code > if the option
8484 represented by the <code >java.lang.String</code > is present, otherwise
@@ -208,11 +208,11 @@ Option find = OptionBuilder.withArgName( "file" )
208208 <subsection name =" Create the Options" >
209209 <p >
210210 Now that we have created each
211- <a href =" apidocs /org/apache/commons/cli/Option.html" >Option</a > we need
211+ <a href =" api-1.1 /org/apache/commons/cli/Option.html" >Option</a > we need
212212 to create the
213- <a href =" apidocs /org/apache/commons/cli/Options.html" >Options</a >
213+ <a href =" api-1.1 /org/apache/commons/cli/Options.html" >Options</a >
214214 instance. This is achieved using the
215- <a href =" apidocs /org/apache/commons/cli/CommandLine.html#addOption(org.apache.commons.cli.Option)" >addOption</a >
215+ <a href =" api-1.1 /org/apache/commons/cli/CommandLine.html#addOption(org.apache.commons.cli.Option)" >addOption</a >
216216 method of <code >Options</code >.
217217 </p >
218218 <source >Options options = new Options();
@@ -239,8 +239,8 @@ options.addOption( property );</source>
239239 <p >
240240 We now need to create a <code >Parser</code >. This will parse the command
241241 line arguments, using the rules specified by the <code >Options</code > and
242- return an instance of <a href =" apidocs /org/apache/commons/cli/CommandLine.html" >CommandLine</a >.
243- This time we will use a <a href =" apidocs /org/apache/commons/cli/GnuParser.html" >GnuParser</a >
242+ return an instance of <a href =" api-1.1 /org/apache/commons/cli/CommandLine.html" >CommandLine</a >.
243+ This time we will use a <a href =" api-1.1 /org/apache/commons/cli/GnuParser.html" >GnuParser</a >
244244 which is able to handle options that are more than one character long.
245245 </p >
246246 <source >public static void main( String[] args ) {
@@ -272,7 +272,7 @@ if( line.hasOption( "buildfile" ) ) {
272272 <p >
273273 CLI also provides the means to automatically generate usage
274274 and help information. This is achieved with the
275- <a href =" apidocs /org/apache/commons/cli/HelpFormatter.html" >HelpFormatter</a >
275+ <a href =" api-1.1 /org/apache/commons/cli/HelpFormatter.html" >HelpFormatter</a >
276276 class.
277277 </p >
278278 <source >// automatically generate the help statement
@@ -307,7 +307,7 @@ formatter.printHelp( "ant", options );</source>
307307 <p >
308308 One of the most widely used command line applications in the *nix world
309309 is <code >ls</code >. To parse a command line for an application like this
310- we will use the <a href =" apidocs /org/apache/commons/cli/PosixParser.html" >PosixParser</a >.
310+ we will use the <a href =" api-1.1 /org/apache/commons/cli/PosixParser.html" >PosixParser</a >.
311311 Due to the large number of options required for <code >ls</code > this
312312 example will only cover a small proportion of the options. The following
313313 is a section of the help output.
@@ -328,7 +328,7 @@ Sort entries alphabetically if none of -cftuSUX nor --sort.
328328-C list entries by columns</source >
329329 <p >
330330 The following is the code that is used to create the
331- <a href =" apidocs /org/apache/commons/cli/Options.html" >Options</a > for this example.
331+ <a href =" api-1.1 /org/apache/commons/cli/Options.html" >Options</a > for this example.
332332 </p >
333333 <source >// create the command line parser
334334CommandLineParser parser = new PosixParser();
0 commit comments