Package org.apache.commons.cli

Examples of org.apache.commons.cli.MissingOptionException


                                        + java.util.Arrays.asList(BaseLayer
                                                .values()), ex);
                    }
                    if (baseLayers[i].charAt(0) == 'G'
                            && !cl.hasOption(OPT_API_KEY.charAt(0))) {
                        throw new MissingOptionException(
                                "You must specify a google maps api key when you use a google maps base layer.");
                    }
                }
                app.setBaseLayers(bL);
            }
View Full Code Here


                } finally {
                    in.close();
                }
                app.addGPX(xgpx);
            } else if (!readGpsTag) {
                throw new MissingOptionException(
                        "You must use at least one of the -g and the -r options.");
            }

            /* output options */

 
View Full Code Here

                    if (input == null) {
                        System.exit(1);
                    }

                    if (this.app.getOutputDirectory() == null) {
                        throw new MissingOptionException(OPT_TO_DIR);
                    }

                    app.addElevations(input);
                }
            } catch (Exception ex) {
View Full Code Here

                isNoOp = false;
            }
           
            if (isNoOp)
            {
                throw new MissingOptionException("You must provide at least one of the -T, -R, -W options.");
            }           
           
            opt = OPT_OVERWRITE;
            c = opt.charAt(0);
            if (cl.hasOption(c)) {
View Full Code Here

                        return;
                    case OVLINPUT:
                        app.ovl2gpx(System.in, System.out);
                        return;
                    default:
                        throw new MissingOptionException(
                                "You must specify the conversion direction when"
                                        + " processing standard input.");
                    }
                }
                File[] input = getInputFiles();
View Full Code Here

            /* output options */
            opt = OPT_HTML;
            c = opt.charAt(0);
            if (cl.hasOption(c)) {
                if (!cl.hasOption(OPT_API_KEY.charAt(0))) {
                    throw new MissingOptionException(
                            "HTML output requires that a google maps api key "
                                    + "is specified with the -"
                                    + OPT_API_KEY.charAt(0) + ",--"
                                    + OPT_API_KEY + " option.");
                }
View Full Code Here

     */
    void setDefaults(UiOption[] uiOpts, boolean suppress_console) throws Exception {
        for (UiOption uiopt : uiOpts) {
            if (!cli_props.containsKey(uiopt.pname())) {
                if (uiopt.required()) {
                    throw new MissingOptionException("Missing required option: " + uiopt.pname());
                }
                if (uiopt.deflt() != null) {
                    if (debug) System.out.println("CLI set default: " + uiopt.pname() + " = " + uiopt.deflt());
                    cli_props.put(uiopt.pname(), uiopt.deflt());
                }
View Full Code Here

        final CommandLine parsedCommandLine = commandLineParser.parse(commandLineOptions, args);

        /* If -xml specified, make sure -xsl is also. */
        if (parsedCommandLine.hasOption("xml")
                && ! parsedCommandLine.hasOption("xsl")) {
            throw new MissingOptionException("-xml switch requires -xsl switch, to specify the stylesheet");
        }

        /* If -xsl specified, make sure -xml is also. */
        if (parsedCommandLine.hasOption("xsl")
                && ! parsedCommandLine.hasOption("xml")) {
            throw new MissingOptionException("-xsl switch requires -xml switch, to specify the document");
        }

        return parsedCommandLine;
    }
View Full Code Here

        main.setUIDSuffix(cl.getOptionValue("uid-suffix"));
    }

    public static String outputFileOf(CommandLine cl) throws MissingOptionException {
        if (!cl.hasOption("o"))
            throw new MissingOptionException(rb.getString("missing-o-file"));
        return cl.getOptionValue("o");
    }
View Full Code Here

        return cl.getOptionValue("o");
    }

    private static String documentTitleOf(CommandLine cl) throws MissingOptionException {
        if (!cl.hasOption("title"))
            throw new MissingOptionException(rb.getString("missing-title"));
        return cl.getOptionValue("title");
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.cli.MissingOptionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.