Options

  /**
     * Add an option that only contains a short-name.
     * It may be specified as requiring an argument.
     *
     * @param opt Short single-character name of the option.
     * @param hasArg flag signally if an argument is required after this option
     * @param description Self-documenting description
     * @return the resulting Options instance
     */
    public Options addOption(String opt, boolean hasArg, String description)
    {
        addOption(opt, null, hasArg, description);


        return this;

    }

 /**
     * Adds an option instance
     *
     * @param opt the option that is to be added
     * @return the resulting Options instance
     */
    public Options addOption(Option opt)
    {
        String key = opt.getKey();


        // add it to the long option list
        if (opt.hasLongOpt())
        {
            longOpts.put(opt.getLongOpt(), opt);
        }


        // if the option is required add it to the required list
        if (opt.isRequired())
        {
            if (requiredOpts.contains(key))
            {
                requiredOpts.remove(requiredOpts.indexOf(key));
            }
            requiredOpts.add(key);
        }


        shortOpts.put(key, opt);


        return this;
    }

 Options addOption(Option opt) 
          Adds an option instance
 Options addOption(String opt, boolean hasArg, String description) 
          Add an option that only contains a short-name.

没看出来两个有啥区别,我今天用第二个,出错,现在怀疑是脚本问题

你可能感兴趣的:(String,list,脚本,null)