    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      https://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
    018package org.apache.commons.cli;
    019
    020/**
    021 * A class that implements the {@code CommandLineParser} interface can parse a String array according to the
    022 * {@link Options} specified and return a {@link CommandLine}.
    023 */
    024public interface CommandLineParser {
    025
    026    /**
    027     * Parses the arguments according to the specified options.
    028     *
    029     * @param options the specified Options
    030     * @param arguments the command line arguments
    031     * @return the list of atomic option and value tokens
    032     * @throws ParseException if there are any problems encountered while parsing the command line tokens.
    033     */
    034    CommandLine parse(Options options, String[] arguments) throws ParseException;
    035
    036    /**
    037     * Parses the arguments according to the specified options and properties.
    038     *
    039     * @param options the specified Options
    040     * @param arguments the command line arguments
    041     * @param properties command line option name-value pairs
    042     * @return the list of atomic option and value tokens
    043     * @throws ParseException if there are any problems encountered while parsing the command line tokens.
    044     */
    045    /*
    046     * To maintain binary compatibility, this is commented out. It is still in the abstract Parser class, so most users will
    047     * still reap the benefit. CommandLine parse(Options options, String[] arguments, Properties properties) throws
    048     * ParseException;
    049     */
    050
    051    /**
    052     * Parses the arguments according to the specified options.
    053     *
    054     * @param options the specified Options
    055     * @param arguments the command line arguments
    056     * @param stopAtNonOption if {@code true} an unrecognized argument stops the parsing and the remaining arguments
    057     *        are added to the {@link CommandLine}s args list. If {@code false} an unrecognized argument triggers a
    058     *        ParseException.
    059     *
    060     * @return the list of atomic option and value tokens
    061     * @throws ParseException if there are any problems encountered while parsing the command line tokens.
    062     */
    063    CommandLine parse(Options options, String[] arguments, boolean stopAtNonOption) throws ParseException;
    064
    065    /**
    066     * Parses the arguments according to the specified options and properties.
    067     *
    068     * @param options the specified Options
    069     * @param arguments the command line arguments
    070     * @param properties command line option name-value pairs
    071     * @param stopAtNonOption if {@code true} an unrecognized argument stops the parsing and the remaining arguments
    072     *        are added to the {@link CommandLine}s args list. If {@code false} an unrecognized argument triggers a
    073     *        ParseException.
    074     *
    075     * @return the list of atomic option and value tokens
    076     * @throws ParseException if there are any problems encountered while parsing the command line tokens.
    077     */
    078    /*
    079     * To maintain binary compatibility, this is commented out. It is still in the abstract Parser class, so most users will
    080     * still reap the benefit. CommandLine parse(Options options, String[] arguments, Properties properties, boolean
    081     * stopAtNonOption) throws ParseException;
    082     */
    083}