001    /**
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    
018    package org.apache.commons.cli;
019    
020    /**
021     * A class that implements the <code>CommandLineParser</code> interface
022     * can parse a String array according to the {@link Options} specified
023     * and return a {@link CommandLine}.
024     *
025     * @author John Keyes (john at integralsource.com)
026     * @version $Revision: 680644 $, $Date: 2008-07-29 01:13:48 -0700 (Tue, 29 Jul 2008) $
027     */
028    public interface CommandLineParser
029    {
030        /**
031         * Parse the arguments according to the specified options.
032         *
033         * @param options the specified Options
034         * @param arguments the command line arguments
035         * @return the list of atomic option and value tokens
036         *
037         * @throws ParseException if there are any problems encountered
038         * while parsing the command line tokens.
039         */
040        CommandLine parse(Options options, String[] arguments) throws ParseException;
041    
042        /**
043         * Parse the arguments according to the specified options and
044         * properties.
045         *
046         * @param options the specified Options
047         * @param arguments the command line arguments
048         * @param properties command line option name-value pairs
049         * @return the list of atomic option and value tokens
050         *
051         * @throws ParseException if there are any problems encountered
052         * while parsing the command line tokens.
053         */
054        /* To maintain binary compatibility, this is commented out.
055           It is still in the abstract Parser class, so most users will
056           still reap the benefit.
057        CommandLine parse(Options options, String[] arguments, Properties properties)
058                   throws ParseException;
059         */
060    
061        /**
062         * Parse the arguments according to the specified options.
063         *
064         * @param options the specified Options
065         * @param arguments the command line arguments
066         * @param stopAtNonOption specifies whether to continue parsing the
067         * arguments if a non option is encountered.
068         *
069         * @return the list of atomic option and value tokens
070         * @throws ParseException if there are any problems encountered
071         * while parsing the command line tokens.
072         */
073        CommandLine parse(Options options, String[] arguments, boolean stopAtNonOption) throws ParseException;
074    
075        /**
076         * Parse the arguments according to the specified options and
077         * properties.
078         *
079         * @param options the specified Options
080         * @param arguments the command line arguments
081         * @param properties command line option name-value pairs
082         * @param stopAtNonOption specifies whether to continue parsing the
083         *
084         * @return the list of atomic option and value tokens
085         * @throws ParseException if there are any problems encountered
086         * while parsing the command line tokens.
087         */
088        /* To maintain binary compatibility, this is commented out.
089           It is still in the abstract Parser class, so most users will
090           still reap the benefit.
091        CommandLine parse(Options options, String[] arguments, Properties properties, boolean stopAtNonOption)
092                throws ParseException;
093         */
094    }