Package gnu.getopt

Examples of gnu.getopt.LongOpt


        Integer resourceId = null;
        boolean verbose = false;
        boolean full = false;

        String sopts = "-p:i:r:fvb:";
        LongOpt[] lopts = { new LongOpt("plugin", LongOpt.REQUIRED_ARGUMENT, null, 'p'), //
            new LongOpt("resourceId", LongOpt.REQUIRED_ARGUMENT, null, 'i'), //
            new LongOpt("resourceType", LongOpt.REQUIRED_ARGUMENT, null, 'r'), //
            new LongOpt("full", LongOpt.NO_ARGUMENT, null, 'f'), //
            new LongOpt("verbose", LongOpt.NO_ARGUMENT, null, 'v'), //
            new LongOpt("blacklist", LongOpt.REQUIRED_ARGUMENT, null, 'b') };

        Getopt getopt = new Getopt("discovery", args, sopts, lopts);
        int code;

        while ((code = getopt.getopt()) != -1) {
View Full Code Here


    private void processArguments(AgentMain agent, String[] args) {
        PrintWriter out = agent.getOut();

        String sopts = "dfv:";
        LongOpt[] lopts = { new LongOpt("verbose", LongOpt.REQUIRED_ARGUMENT, null, 'v'),
            new LongOpt("dump", LongOpt.NO_ARGUMENT, null, 'd'), new LongOpt("free", LongOpt.NO_ARGUMENT, null, 'f') };

        Getopt getopt = new Getopt(getPromptCommandString(), args, sopts, lopts);
        int code;
        Boolean verbose = null;
        Boolean free = null;
View Full Code Here

        boolean verbose = false;
        boolean quiet = false;
        boolean force = false;

        String sopts = "-cvqf";
        LongOpt[] lopts = { new LongOpt("changed", LongOpt.NO_ARGUMENT, null, 'c'),
            new LongOpt("verbose", LongOpt.NO_ARGUMENT, null, 'v'),
            new LongOpt("quiet", LongOpt.NO_ARGUMENT, null, 'q'),
            new LongOpt("force", LongOpt.NO_ARGUMENT, null, 'f') };

        Getopt getopt = new Getopt(getPromptCommandString(), args, sopts, lopts);
        int code;

        while ((code = getopt.getopt()) != -1) {
View Full Code Here

     * @throws IllegalArgumentException if an argument was invalid
     * @throws HelpException            if help was requested and the agent should not be created
     */
    private void processArguments(String[] args) throws Exception {
        String sopts = "-:hdlLasntguD:i:o:c:p:e:";
        LongOpt[] lopts = { new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'h'),
            new LongOpt("input", LongOpt.REQUIRED_ARGUMENT, null, 'i'),
            new LongOpt("output", LongOpt.REQUIRED_ARGUMENT, null, 'o'),
            new LongOpt("config", LongOpt.REQUIRED_ARGUMENT, null, 'c'),
            new LongOpt("pref", LongOpt.REQUIRED_ARGUMENT, null, 'p'),
            new LongOpt("console", LongOpt.REQUIRED_ARGUMENT, null, 'e'),
            new LongOpt("daemon", LongOpt.NO_ARGUMENT, null, 'd'),
            new LongOpt("cleanconfig", LongOpt.NO_ARGUMENT, null, 'l'),
            new LongOpt("fullcleanconfig", LongOpt.NO_ARGUMENT, null, 'L'),
            new LongOpt("advanced", LongOpt.NO_ARGUMENT, null, 'a'),
            new LongOpt("setup", LongOpt.NO_ARGUMENT, null, 's'),
            new LongOpt("nostart", LongOpt.NO_ARGUMENT, null, 'n'),
            new LongOpt("nonative", LongOpt.NO_ARGUMENT, null, 't'),
            new LongOpt("purgeplugins", LongOpt.NO_ARGUMENT, null, 'g'),
            new LongOpt("purgedata", LongOpt.NO_ARGUMENT, null, 'u') };

        String config_file_name = null;
        boolean clean_config = false;
        boolean clean_token = false; // only used if clean_config = true
        boolean purge_data = false;
View Full Code Here

        m_params = new HashMap<String, Object>();

        // set this from a system property or default to the client classname
        String programName = System.getProperty("program.name", this.getClass().getName());
        String sopts = "-:hv:p:c:l:u:s:";
        LongOpt[] lopts = { new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'h'),
            new LongOpt("pkgs", LongOpt.REQUIRED_ARGUMENT, null, 'p'),
            new LongOpt("cmd", LongOpt.REQUIRED_ARGUMENT, null, 'c'),
            new LongOpt("version", LongOpt.REQUIRED_ARGUMENT, null, 'v'),
            new LongOpt("class", LongOpt.REQUIRED_ARGUMENT, null, 'l'),
            new LongOpt("uri", LongOpt.REQUIRED_ARGUMENT, null, 'u'),
            new LongOpt("subsystem", LongOpt.REQUIRED_ARGUMENT, null, 's'), };

        Getopt getopt = new Getopt(programName, args, sopts, lopts);
        int code;
        String arg;
View Full Code Here

    public ScriptCmdLine parse(String[] cmdLine) throws CommandLineParseException {
        String[] args = Arrays.copyOfRange(cmdLine, 1, cmdLine.length);
       
        String shortOpts = "-:f:";
        LongOpt[] longOpts = {
                new LongOpt("file", LongOpt.REQUIRED_ARGUMENT, null, 'f'),
                new LongOpt("args-style", LongOpt.REQUIRED_ARGUMENT, null, -2)
        };
        Getopt getopt = new Getopt("exec", args, shortOpts, longOpts, false);

        List<String> scriptArgs = new ArrayList<String>();
        String argStyle = "indexed";
View Full Code Here

    }
   
    public static void main(String[] args) throws Exception {
        LongOpt[] longOptions = new LongOpt[10];
       
        longOptions[0] = new LongOpt("url", LongOpt.REQUIRED_ARGUMENT, null, 'r');
        longOptions[1] = new LongOpt("user", LongOpt.REQUIRED_ARGUMENT, null, 'u');
        longOptions[2] = new LongOpt("password", LongOpt.REQUIRED_ARGUMENT, null, 'p');
        longOptions[3] = new LongOpt("driver-class", LongOpt.REQUIRED_ARGUMENT, null, 'd');
        longOptions[4] = new LongOpt("config-file", LongOpt.REQUIRED_ARGUMENT, null, 'c');
        longOptions[5] = new LongOpt("export", LongOpt.NO_ARGUMENT, null, 'e');
        longOptions[6] = new LongOpt("import", LongOpt.NO_ARGUMENT, null, 'i');
        longOptions[7] = new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'h');
        longOptions[8] = new LongOpt("file", LongOpt.REQUIRED_ARGUMENT, null, 'f');
        longOptions[9] = new LongOpt("format", LongOpt.REQUIRED_ARGUMENT, null, 'o');
       
        Getopt options = new Getopt("data", args, "eihr:u:p:d:c:f:o:", longOptions);
       
        String url = null;
        String user = null;
View Full Code Here

        if (args.length <= 0) {
            throw new UnsupportedOperationException();
        }

        String sopts = "u::i::qhvo:j:p::s:l:";
        LongOpt[] lopts = { new LongOpt("update", LongOpt.OPTIONAL_ARGUMENT, null, 'u'), // updates existing agent
            new LongOpt("install", LongOpt.OPTIONAL_ARGUMENT, null, 'i'), // installs agent
            new LongOpt("quiet", LongOpt.NO_ARGUMENT, null, 'q'), // if not set, dumps log message to stdout too
            new LongOpt("launch", LongOpt.REQUIRED_ARGUMENT, null, 'l'), // if agent should be started or not
            new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'h'), // will show the syntax help
            new LongOpt("version", LongOpt.NO_ARGUMENT, null, 'v'), // shows version info
            new LongOpt("log", LongOpt.REQUIRED_ARGUMENT, null, 'o'), // location of the log file
            new LongOpt("jar", LongOpt.REQUIRED_ARGUMENT, null, 'j'), // location of an external jar that has our agent
            new LongOpt("pause", LongOpt.OPTIONAL_ARGUMENT, null, 'p'), // pause (sleep) before updating
            new LongOpt("script", LongOpt.REQUIRED_ARGUMENT, null, 's') }; // switch immediately to the given server

        Getopt getopt = new Getopt(AgentUpdate.class.getSimpleName(), args, sopts, lopts);
        int code;
        long pause = -1L;
View Full Code Here

    StartupConfiguration processArguments(String[] args) throws IllegalArgumentException, IOException {
        StartupConfiguration config = new StartupConfiguration();

        String sopts = "-:hu:p:Ps:t:r:c:f:v";
        LongOpt[] lopts = { new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'h'),
            new LongOpt("user", LongOpt.REQUIRED_ARGUMENT, null, 'u'),
            new LongOpt("password", LongOpt.REQUIRED_ARGUMENT, null, 'p'),
            new LongOpt("prompt", LongOpt.OPTIONAL_ARGUMENT, null, 'P'),
            new LongOpt("host", LongOpt.REQUIRED_ARGUMENT, null, 's'),
            new LongOpt("port", LongOpt.REQUIRED_ARGUMENT, null, 't'),
            new LongOpt("transport", LongOpt.REQUIRED_ARGUMENT, null, 'r'),
            new LongOpt("command", LongOpt.REQUIRED_ARGUMENT, null, 'c'),
            new LongOpt("file", LongOpt.NO_ARGUMENT, null, 'f'),
            new LongOpt("version", LongOpt.NO_ARGUMENT, null, 'v'),
            new LongOpt("language", LongOpt.REQUIRED_ARGUMENT, null, 'l'),
            new LongOpt("args-style", LongOpt.REQUIRED_ARGUMENT, null, -2) };

        Getopt getopt = new Getopt("Cli", args, sopts, lopts, false);
        int code;

        List<String> execCmdLine = new ArrayList<String>();
View Full Code Here

    }

    private RecordArgs parseArgs(String[] args) {
        String shortOpts = "-:f:abe";
        LongOpt[] longOpts = {
                new LongOpt("file", LongOpt.REQUIRED_ARGUMENT, null, 'f'),
                new LongOpt("append", LongOpt.OPTIONAL_ARGUMENT, null, 'a'),
                new LongOpt("start", LongOpt.OPTIONAL_ARGUMENT, null, 'b'),
                new LongOpt("end", LongOpt.OPTIONAL_ARGUMENT, null, 'e')
        };
        Getopt getopt = new Getopt(getPromptCommandString(), args, shortOpts, longOpts);
        getopt.setOpterr(false);

        RecordArgs recordArgs = new RecordArgs();
View Full Code Here

TOP

Related Classes of gnu.getopt.LongOpt

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.