Examples of CommandLineParser


Examples of org.apache.commons.cli.CommandLineParser

   
    public static void main(String[] args) throws Exception {
      Options options = getOptions();
      try {
       
        CommandLineParser parser = new GnuParser();

        CommandLine line = parser.parse( options, args );
        File dir = new File(line.getOptionValue("dir", "."));
        Collection files = ListFile.list(dir);
        System.out.println("listing files in "+dir);
        for (Iterator it = files.iterator(); it.hasNext(); ) {
          System.out.println("\t"+it.next()+"\n");
View Full Code Here

Examples of org.apache.commons.cli.CommandLineParser

        return this;
    }

    // Parse the given argument vector
    public Command parse(String[] argv) {
        CommandLineParser parser = new PosixParser();

        CommandLine cmdline = null;
        try {
            cmdline = parser.parse(this.rules, argv);
        }
        catch (ParseException e) {
            error(e.getMessage());
        }
View Full Code Here

Examples of org.apache.cxf.tools.common.toolspec.parser.CommandLineParser

       
    }
   
    public TestUtils(String toolName, InputStream in) throws Exception {
        ToolSpec spec = new ToolSpec(in, false);
        CommandLineParser parser = new CommandLineParser(spec);
        String usage = parser.getUsage();
        mUsage = "Usage : " + toolName + " " + usage;
        mDetailedUsage = toolName + " " + usage + System.getProperty("line.separator")
                          + System.getProperty("line.separator");
        mDetailedUsage += "Options : " + System.getProperty("line.separator") + parser.getDetailedUsage()
                           + System.getProperty("line.separator");
        mDetailedUsage += parser.getToolUsage() + System.getProperty("line.separator")
                           + System.getProperty("line.separator");
    }
View Full Code Here

Examples of org.apache.ivy.util.cli.CommandLineParser

*/
public final class Main {
    private static final int HELP_WIDTH = 80;

    static CommandLineParser getParser() {
        return new CommandLineParser()
                .addCategory("settings options")
                .addOption(
                    new OptionBuilder("settings").arg("settingsfile")
                            .description("use given file for settings").create())
                .addOption(
View Full Code Here

Examples of org.apache.qpid.junit.extensions.util.CommandLineParser

    public static void main(String[] args)
    {
        try
        {
            Properties options =
                CommandLineParser.processCommandLine(args, new CommandLineParser(new String[][] {}), System.getProperties());

            // Create a ping producer overriding its defaults with all options passed on the command line.
            PingPongProducer pingProducer = new PingPongProducer(options);
            pingProducer.establishConnection(true, true);
View Full Code Here

Examples of org.apache.qpid.util.CommandLineParser

    public static void main(String[] args)
    {
        PersistentTestManual test;

        Properties options =
                CommandLineParser.processCommandLine(args, new CommandLineParser(new String[][]{}), System.getProperties());

        test = new PersistentTestManual(options);
        try
        {
            test.test();
View Full Code Here

Examples of org.apache.uima.internal.util.CommandLineParser

  private static final String MAIN_COMPONENT_DIR_PARAM = "-mainCompDir";

  private static final String TARGET_DIR_PARAM = "-targetDir";

  private static final CommandLineParser createCmdLineParser() {
    CommandLineParser parser = new CommandLineParser();
    parser.addParameter(INSTALL_ACTION_PARAM, false);
    parser.addParameter(PACKAGE_ACTION_PARAM, false);
    parser.addParameter(COMPONENT_ID_PARAM, true);
    parser.addParameter(MAIN_COMPONENT_DESC_PARAM, true);
    parser.addParameter(CLASSPATH_PARAM, true);
    parser.addParameter(DATAPATH_PARAM, true);
    parser.addParameter(ENV_VAR_PARAM, true);
    parser.addParameter(MAIN_COMPONENT_DIR_PARAM, true);
    parser.addParameter(TARGET_DIR_PARAM, true);
    return parser;
  }
View Full Code Here

Examples of org.gradle.cli.CommandLineParser

        this.parameters = parameters;
    }

    public LogLevel getBuildLogLevel() {
        LoggingCommandLineConverter converter = new LoggingCommandLineConverter();
        CommandLineParser parser = new CommandLineParser().allowUnknownOptions().allowMixedSubcommandsAndOptions();
        converter.configure(parser);
        ParsedCommandLine parsedCommandLine = parser.parse(parameters.getArguments(Collections.<String>emptyList()));
        //configure verbosely only if arguments do not specify any log level.
        if (parameters.getVerboseLogging(false) && !parsedCommandLine.hasAnyOption(converter.getLogLevelOptions())) {
            return LogLevel.DEBUG;
        }
View Full Code Here

Examples of org.gradle.initialization.CommandLineParser

        List<String> remainingPaths = paths;
        while (!remainingPaths.isEmpty()) {
            String path = remainingPaths.get(0);
            selector.selectTasks(gradle, path);

            CommandLineParser commandLineParser = new CommandLineParser();
            Set<Task> tasks = selector.getTasks();
            Map<String, JavaMethod<Task, ?>> options = new HashMap<String, JavaMethod<Task, ?>>();
            if (tasks.size() == 1) {
                for (Class<?> type = tasks.iterator().next().getClass(); type != Object.class; type = type.getSuperclass()) {
                    for (Method method : type.getDeclaredMethods()) {
                        CommandLineOption commandLineOption = method.getAnnotation(CommandLineOption.class);
                        if (commandLineOption != null) {
                            commandLineParser.option(commandLineOption.options()).hasDescription(commandLineOption.description());
                            options.put(commandLineOption.options()[0], new JavaMethod<Task, Object>(Task.class, Object.class, method));
                        }
                    }
                }
            }

            ParsedCommandLine commandLine = commandLineParser.parse(remainingPaths.subList(1, remainingPaths.size()));
            for (Map.Entry<String, JavaMethod<Task, ?>> entry : options.entrySet()) {
                if (commandLine.hasOption(entry.getKey())) {
                    for (Task task : tasks) {
                        entry.getValue().invoke(task, true);
                    }
View Full Code Here

Examples of org.gradle.initialization.CommandLineParser

        return this;
    }

    @Override
    public GradleExecuter withArguments(List<String> args) {
        CommandLineParser parser = new CommandLineParser();
        DefaultCommandLineConverter converter = new DefaultCommandLineConverter();
        converter.configure(parser);
        converter.convert(parser.parse(args), parameter);
        return this;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.