Example usage for org.apache.commons.cli GnuParser GnuParser

List of usage examples for org.apache.commons.cli GnuParser GnuParser

Introduction

In this page you can find the example usage for org.apache.commons.cli GnuParser GnuParser.

Prototype

GnuParser

Source Link

Usage

From source file:com.controlj.experiment.bulktrend.trendclient.Main.java

public static void main(String args[]) {

    Options options = setupCLOptions();/*from  w  ww  .  j a v  a 2s  .c o  m*/
    CommandLineParser parser = new GnuParser();
    CommandLine line = null;

    try {
        line = parser.parse(options, args);
    } catch (ParseException e) {
        System.err.println("Command line parsing failed: " + e.getMessage());
        System.exit(-1);
    }

    if (line.hasOption("help")) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("trendclient", options);
        printConfigHelp();
        System.exit(0);
    }

    // dir option - read config files
    File baseDir = new File("");
    if (line.hasOption(PARAM_DIR)) {
        baseDir = new File(line.getOptionValue(PARAM_DIR));
    }
    Properties props = getProperties(baseDir);

    String server = getProperty(props, PROP_SERVER);
    String parserName = getProperty(props, PROP_PARSER);
    String handlerName = getProperty(props, PROP_HANDLER);
    String user = getProperty(props, PROP_USER);
    String pw = getProperty(props, PROP_PASSWORD);

    TrendClient tc = new TrendClient(server, getIDs(baseDir), user, pw, handlerName, parserName);

    String defaultDigitsString = props.getProperty(PROP_DIGITS);
    if (defaultDigitsString != null) {
        try {
            tc.setDefaultDigits(Integer.parseInt(defaultDigitsString));
        } catch (NumberFormatException e) {
            System.err.println("Invalid valid for property " + PROP_DIGITS + ":" + defaultDigitsString);
        }
    }

    //testfile
    if (line.hasOption(PARAM_TESTFILE)) {
        String fileName = line.getOptionValue(PARAM_TESTFILE);
        if (fileName == null) {
            fileName = "response.dump";
        }
        try {
            tc.setAlternateInput(new FileInputStream(new File(fileName)));
            System.out.println("Reading trends from file: " + fileName);
        } catch (FileNotFoundException e) {
            System.err.println("Error, " + PARAM_TESTFILE + " '" + fileName + "' not found");
        }
    } else {
        System.out.println("Reading trends from " + server);
        System.out.println("Parser=" + parserName);
        System.out.println("Handler=" + handlerName);
    }

    // Start/End
    Date start = parseDateOption(PARAM_START, line);
    Date end = parseDateOption(PARAM_END, line);
    if (start == null) {
        start = TrendClient.getYesterday().getTime();
    }
    if (end == null) {
        end = TrendClient.getYesterday().getTime();
    }
    tc.setStart(start);
    tc.setEnd(end);
    System.out.println("From " + start + " to " + end);

    // nozip
    if (line.hasOption(PARAM_NOZIP)) {
        tc.setZip(false);
    }

    tc.go();
}

From source file:io.s4.tools.loadgenerator.LoadGenerator.java

public static void main(String args[]) {
    Options options = new Options();
    boolean warmUp = false;

    options.addOption(/* w ww.  j a va  2 s  .c  om*/
            OptionBuilder.withArgName("rate").hasArg().withDescription("Rate (events per second)").create("r"));

    options.addOption(OptionBuilder.withArgName("display_rate").hasArg()
            .withDescription("Display Rate at specified second boundary").create("d"));

    options.addOption(OptionBuilder.withArgName("adapter_address").hasArg()
            .withDescription("Address of client adapter").create("a"));

    options.addOption(OptionBuilder.withArgName("listener_application_name").hasArg()
            .withDescription("Listener application name").create("g"));

    options.addOption(
            OptionBuilder.withArgName("sleep_overhead").hasArg().withDescription("Sleep overhead").create("o"));

    options.addOption(new Option("w", "Warm-up"));

    CommandLineParser parser = new GnuParser();

    CommandLine line = null;
    try {
        // parse the command line arguments
        line = parser.parse(options, args);
    } catch (ParseException exp) {
        // oops, something went wrong
        System.err.println("Parsing failed.  Reason: " + exp.getMessage());
        System.exit(1);
    }

    int expectedRate = 250;
    if (line.hasOption("r")) {
        try {
            expectedRate = Integer.parseInt(line.getOptionValue("r"));
        } catch (Exception e) {
            System.err.println("Bad expected rate specified " + line.getOptionValue("r"));
            System.exit(1);
        }
    }

    int displayRateIntervalSeconds = 20;
    if (line.hasOption("d")) {
        try {
            displayRateIntervalSeconds = Integer.parseInt(line.getOptionValue("d"));
        } catch (Exception e) {
            System.err.println("Bad display rate value specified " + line.getOptionValue("d"));
            System.exit(1);
        }
    }

    int updateFrequency = 0;
    if (line.hasOption("f")) {
        try {
            updateFrequency = Integer.parseInt(line.getOptionValue("f"));
        } catch (Exception e) {
            System.err.println("Bad query udpdate frequency specified " + line.getOptionValue("f"));
            System.exit(1);
        }
        System.out.printf("Update frequency is %d\n", updateFrequency);
    }

    String clientAdapterAddress = null;
    String clientAdapterHost = null;
    int clientAdapterPort = -1;
    if (line.hasOption("a")) {
        clientAdapterAddress = line.getOptionValue("a");
        String[] parts = clientAdapterAddress.split(":");
        if (parts.length != 2) {
            System.err.println("Bad adapter address specified " + clientAdapterAddress);
            System.exit(1);
        }
        clientAdapterHost = parts[0];

        try {
            clientAdapterPort = Integer.parseInt(parts[1]);
        } catch (NumberFormatException nfe) {
            System.err.println("Bad adapter address specified " + clientAdapterAddress);
            System.exit(1);
        }
    }

    long sleepOverheadMicros = -1;
    if (line.hasOption("o")) {
        try {
            sleepOverheadMicros = Long.parseLong(line.getOptionValue("o"));
        } catch (NumberFormatException e) {
            System.err.println("Bad sleep overhead specified " + line.getOptionValue("o"));
            System.exit(1);
        }
        System.out.printf("Specified sleep overhead is %d\n", sleepOverheadMicros);
    }

    if (line.hasOption("w")) {
        warmUp = true;
    }

    List loArgs = line.getArgList();
    if (loArgs.size() < 1) {
        System.err.println("No input file specified");
        System.exit(1);
    }

    String inputFilename = (String) loArgs.get(0);

    LoadGenerator loadGenerator = new LoadGenerator();
    loadGenerator.setInputFilename(inputFilename);
    loadGenerator.setDisplayRateInterval(displayRateIntervalSeconds);
    loadGenerator.setExpectedRate(expectedRate);
    loadGenerator.setClientAdapterHost(clientAdapterHost);
    loadGenerator.setClientAdapterPort(clientAdapterPort);
    loadGenerator.run();

    System.exit(0);
}

From source file:cc.twittertools.search.api.TrecSearchThriftServer.java

@SuppressWarnings("static-access")
public static void main(String[] args) throws Exception {
    Options options = new Options();

    options.addOption(new Option(HELP_OPTION, "show help"));
    options.addOption(OptionBuilder.withArgName("port").hasArg().withDescription("port").create(PORT_OPTION));
    options.addOption(//from  w ww  . j av  a2 s .co  m
            OptionBuilder.withArgName("index").hasArg().withDescription("index location").create(INDEX_OPTION));
    options.addOption(OptionBuilder.withArgName("num").hasArg()
            .withDescription("max number of threads in thread pool").create(MAX_THREADS_OPTION));
    options.addOption(OptionBuilder.withArgName("file").hasArg()
            .withDescription("file containing access tokens").create(CREDENTIALS_OPTION));

    CommandLine cmdline = null;
    CommandLineParser parser = new GnuParser();
    try {
        cmdline = parser.parse(options, args);
    } catch (ParseException exp) {
        System.err.println("Error parsing command line: " + exp.getMessage());
        System.exit(-1);
    }

    if (cmdline.hasOption(HELP_OPTION) || !cmdline.hasOption(INDEX_OPTION)) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(TrecSearchThriftServer.class.getName(), options);
        System.exit(-1);
    }

    int port = cmdline.hasOption(PORT_OPTION) ? Integer.parseInt(cmdline.getOptionValue(PORT_OPTION))
            : DEFAULT_PORT;
    int maxThreads = cmdline.hasOption(MAX_THREADS_OPTION)
            ? Integer.parseInt(cmdline.getOptionValue(MAX_THREADS_OPTION))
            : DEFAULT_MAX_THREADS;
    File index = new File(cmdline.getOptionValue(INDEX_OPTION));

    Map<String, String> credentials = null;
    if (cmdline.hasOption(CREDENTIALS_OPTION)) {
        credentials = Maps.newHashMap();
        File cfile = new File(cmdline.getOptionValue(CREDENTIALS_OPTION));
        if (!cfile.exists()) {
            System.err.println("Error: " + cfile + " does not exist!");
            System.exit(-1);
        }
        for (String s : Files.readLines(cfile, Charsets.UTF_8)) {
            try {
                String[] arr = s.split(":");
                credentials.put(arr[0], arr[1]);
            } catch (Exception e) {
                // Catch any exceptions from parsing file contain access tokens
                System.err.println("Error reading access tokens from " + cfile + "!");
                System.exit(-1);
            }
        }
    }

    if (!index.exists()) {
        System.err.println("Error: " + index + " does not exist!");
        System.exit(-1);
    }

    TServerSocket serverSocket = new TServerSocket(port);
    TrecSearch.Processor<TrecSearch.Iface> searchProcessor = new TrecSearch.Processor<TrecSearch.Iface>(
            new TrecSearchHandler(index, credentials));

    TThreadPoolServer.Args serverArgs = new TThreadPoolServer.Args(serverSocket);
    serverArgs.maxWorkerThreads(maxThreads);
    TServer thriftServer = new TThreadPoolServer(
            serverArgs.processor(searchProcessor).protocolFactory(new TBinaryProtocol.Factory()));

    thriftServer.serve();
}

From source file:com.datatorrent.stram.StreamingAppMaster.java

/**
 * @param args/*www  .  j  ava  2 s  .com*/
 *          Command line args
 * @throws Throwable
 */
public static void main(final String[] args) throws Throwable {
    StdOutErrLog.tieSystemOutAndErrToLog();
    LOG.info("Master starting with classpath: {}", System.getProperty("java.class.path"));

    LOG.info("version: {}", VersionInfo.APEX_VERSION.getBuildVersion());
    StringWriter sw = new StringWriter();
    for (Map.Entry<String, String> e : System.getenv().entrySet()) {
        sw.append("\n").append(e.getKey()).append("=").append(e.getValue());
    }
    LOG.info("appmaster env:" + sw.toString());

    Options opts = new Options();
    opts.addOption("app_attempt_id", true, "App Attempt ID. Not to be used unless for testing purposes");

    opts.addOption("help", false, "Print usage");
    CommandLine cliParser = new GnuParser().parse(opts, args);

    // option "help" overrides and cancels any run
    if (cliParser.hasOption("help")) {
        new HelpFormatter().printHelp("ApplicationMaster", opts);
        return;
    }

    Map<String, String> envs = System.getenv();
    ApplicationAttemptId appAttemptID = Records.newRecord(ApplicationAttemptId.class);
    if (!envs.containsKey(Environment.CONTAINER_ID.name())) {
        if (cliParser.hasOption("app_attempt_id")) {
            String appIdStr = cliParser.getOptionValue("app_attempt_id", "");
            appAttemptID = ConverterUtils.toApplicationAttemptId(appIdStr);
        } else {
            throw new IllegalArgumentException("Application Attempt Id not set in the environment");
        }
    } else {
        ContainerId containerId = ConverterUtils.toContainerId(envs.get(Environment.CONTAINER_ID.name()));
        appAttemptID = containerId.getApplicationAttemptId();
    }

    boolean result = false;
    StreamingAppMasterService appMaster = null;
    try {
        appMaster = new StreamingAppMasterService(appAttemptID);
        LOG.info("Initializing Application Master.");

        Configuration conf = new YarnConfiguration();
        appMaster.init(conf);
        appMaster.start();
        result = appMaster.run();
    } catch (Throwable t) {
        LOG.error("Exiting Application Master", t);
        System.exit(1);
    } finally {
        if (appMaster != null) {
            appMaster.stop();
        }
    }

    if (result) {
        LOG.info("Application Master completed.");
        System.exit(0);
    } else {
        LOG.info("Application Master failed.");
        System.exit(2);
    }
}

From source file:mx.unam.fesa.isoo.msp.MSPMain.java

/**
 * @param args//from   w  ww.  java2  s.  co m
 * @throws Exception
 */
@SuppressWarnings("static-access")
public static void main(String[] args) {

    //
    // creating options
    //

    Options options = new Options();

    // help option
    //
    options.addOption(
            OptionBuilder.withDescription("Prints this message.").withLongOpt("help").create(OPT_HELP));

    // server option
    //
    options.addOption(OptionBuilder.withDescription("The server this MineSweeperPlayer will connect to.")
            .hasArg().withArgName("SERVER").withLongOpt("server").create(OPT_SERVER));

    // port option
    //
    options.addOption(OptionBuilder.withDescription("The port this MineSweeperPlayer will connect to.").hasArg()
            .withType(new Integer(0)).withArgName("PORT").withLongOpt("port").create(OPT_PORT));

    // parsing options
    //
    String hostname = DEFAULT_SERVER;
    int port = DEFAULT_PORT;
    try {
        // using GNU standard
        //
        CommandLine line = new GnuParser().parse(options, args);

        if (line.hasOption(OPT_HELP)) {
            new HelpFormatter().printHelp("msc [options]", options);
            return;
        }

        if (line.hasOption(OPT_PORT)) {
            try {
                port = (Integer) line.getOptionObject(OPT_PORT);
            } catch (Exception e) {
            }
        }

        if (line.hasOption(OPT_SERVER)) {
            hostname = line.getOptionValue(OPT_PORT);
        }
    } catch (ParseException e) {
        System.err.println("Could not parse command line options correctly: " + e.getMessage());
        return;
    }

    //
    // configuring logging services
    //

    try {
        LogManager.getLogManager()
                .readConfiguration(ClassLoader.getSystemResourceAsStream(DEFAULT_LOGGING_CONFIG_FILE));
    } catch (Exception e) {
        throw new Error("Could not load logging properties file.", e);
    }

    //
    // setting up Mine Sweeper client
    //

    try {
        new MSClient(hostname, port);
    } catch (Exception e) {
        System.err.println("Could not execute MineSweeper client: " + e.getMessage());
    }
}

From source file:de.bruse.c2x.cli.Main.java

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

    Option input = new Option("i", INPUT, HAS_ARGS, "CityGML file to be converted.");
    input.setArgs(ONE);// w  w w. ja  v a  2 s  . c om
    input.setArgName(INPUT);
    input.setRequired(Boolean.TRUE);
    options.addOption(input);

    Option levelOfDetail = new Option("l", LEVEL_OF_DETAIL, HAS_ARGS,
            "Level of detail to be converted. Possible values are LOD1 and LOD2.");
    levelOfDetail.setArgs(ONE);
    levelOfDetail.setArgName(LEVEL_OF_DETAIL);
    levelOfDetail.setRequired(Boolean.TRUE);
    options.addOption(levelOfDetail);

    Option geometryType = new Option("t", GEOMETRY_TYPE, HAS_ARGS,
            "Geometry type to be converted. Possible values are SOLID and MULTI_SURFACE.");
    geometryType.setArgs(ONE);
    geometryType.setArgName(GEOMETRY_TYPE);
    geometryType.setRequired(Boolean.TRUE);
    options.addOption(geometryType);

    Option output = new Option("o", OUTPUT, HAS_ARGS, "File path of the output file.");
    output.setArgs(ONE);
    output.setArgName(OUTPUT);
    output.setRequired(Boolean.FALSE);
    options.addOption(output);

    Option targetFormat = new Option("f", FORMAT, HAS_ARGS,
            "Format of the output file. Possible values are X3D and COLLADA.");
    targetFormat.setArgs(ONE);
    targetFormat.setArgName(FORMAT);
    targetFormat.setRequired(Boolean.TRUE);
    options.addOption(targetFormat);

    Option split = new Option("s", SPLIT, NO_ARGS, "Generate one scene node for each building (X3D only).");
    split.setArgName(SPLIT);
    split.setRequired(Boolean.FALSE);
    options.addOption(split);

    Option validate = new Option("v", VALIDATE, NO_ARGS, "Validate the CityGML file.");
    validate.setArgName(VALIDATE);
    validate.setRequired(Boolean.FALSE);
    options.addOption(validate);

    try {
        CommandLine line = parser.parse(options, args);
        if (line.hasOption(INPUT) && line.hasOption(LEVEL_OF_DETAIL) && line.hasOption(GEOMETRY_TYPE)
                && line.hasOption(FORMAT)) {
            String inputValue = line.getOptionValue(INPUT);
            String levelOfDetailValue = line.getOptionValue(LEVEL_OF_DETAIL);
            String geometryTypeValue = line.getOptionValue(GEOMETRY_TYPE);
            String targetFormatValue = line.getOptionValue(FORMAT);
            String outputValue = line.getOptionValue(OUTPUT);
            LevelOfDetail lod = LevelOfDetail.valueOf(levelOfDetailValue);
            GeometryType type = GeometryType.valueOf(geometryTypeValue);
            if (Objects.isNull(lod) || Objects.isNull(type)
                    || (!targetFormatValue.equals(X3D) && !targetFormatValue.equals(COLLADA))) {
                printHelp(options);
            } else {
                if (line.hasOption(VALIDATE)) {
                    triggerValidation(inputValue);
                }
                if (targetFormatValue.equals(X3D)) {
                    boolean splitValue = false;
                    if (line.hasOption(SPLIT)) {
                        splitValue = true;
                    }
                    if (Objects.isNull(outputValue) || outputValue.isEmpty()) {
                        outputValue = inputValue + X3D_FILE_EXT;
                    }
                    triggerX3DConversion(inputValue, lod, type, outputValue, splitValue);
                } else if (targetFormatValue.equals(COLLADA)) {
                    if (Objects.isNull(outputValue) || outputValue.isEmpty()) {
                        outputValue = inputValue + COLLADA_FILE_EXT;
                    }
                    triggerColladaConversion(inputValue, lod, type, outputValue);
                }
                System.out.println("Conversion succeeded.");
            }
        } else {
            printHelp(options);
        }
    } catch (ParseException | IllegalArgumentException e) {
        printHelp(options);
    } catch (ValidationException e) {
        System.out.println("Input file is invalid. Operation canceled.\n" + e.getMessage());
    } catch (ConversionException e) {
        String message = "Failed to convert CityGML.";
        if (Objects.nonNull(e.getMessage())) {
            message += " " + e.getMessage();
        }
        System.out.println(message);
    } catch (IOException e) {
        System.out.println("Failed to read from file '" + input + "'.");
    }
}

From source file:com.consol.citrus.util.TestCaseCreator.java

/**
 * Main CLI method./*w ww  .j  a va  2 s .c  om*/
 * @param args
 */
public static void main(String[] args) {
    Options options = new TestCaseCreatorCliOptions();
    CommandLineParser cliParser = new GnuParser();

    CommandLine cmd = null;

    try {
        cmd = cliParser.parse(options, args);

        if (cmd.hasOption("help")) {
            HelpFormatter formatter = new HelpFormatter();
            formatter.printHelp("CITRUS test creation", options);
            return;
        }

        TestCaseCreator creator = TestCaseCreator.build().withName(cmd.getOptionValue("name"))
                .withAuthor(cmd.getOptionValue("author", "Unknown"))
                .withDescription(cmd.getOptionValue("description", "TODO: Description"))
                .usePackage(cmd.getOptionValue("package", "com.consol.citrus"))
                .withFramework(UnitFramework.fromString(cmd.getOptionValue("framework", "testng")));

        creator.createTestCase();
    } catch (ParseException e) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("\n **** CITRUS TESTCREATOR ****", "\n CLI options:", options, "");
    }
}

From source file:illarion.compile.Compiler.java

public static void main(final String[] args) {
    ByteArrayOutputStream stdOutBuffer = new ByteArrayOutputStream();
    PrintStream orgStdOut = System.out;
    System.setOut(new PrintStream(stdOutBuffer));

    SLF4JBridgeHandler.removeHandlersForRootLogger();
    SLF4JBridgeHandler.install();//from  w ww  .j a va  2s  .  co m

    Options options = new Options();

    final Option npcDir = new Option("n", "npc-dir", true,
            "The place where the compiled NPC files are stored.");
    npcDir.setArgs(1);
    npcDir.setArgName("directory");
    npcDir.setRequired(false);
    options.addOption(npcDir);

    final Option questDir = new Option("q", "quest-dir", true,
            "The place where the compiled Quest files are stored.");
    questDir.setArgs(1);
    questDir.setArgName("directory");
    questDir.setRequired(false);
    options.addOption(questDir);

    final Option type = new Option("t", "type", true,
            "This option is used to set what kind of parser is supposed to be used in case"
                    + " the content of standard input is processed.");
    type.setArgs(1);
    type.setArgName("type");
    type.setRequired(false);
    options.addOption(type);

    CommandLineParser parser = new GnuParser();
    try {
        CommandLine cmd = parser.parse(options, args);

        String[] files = cmd.getArgs();
        if (files.length > 0) {
            System.setOut(orgStdOut);
            stdOutBuffer.writeTo(orgStdOut);

            processFileMode(cmd);
        } else {
            System.setOut(orgStdOut);
            processStdIn(cmd);
        }
    } catch (final ParseException e) {
        final HelpFormatter helpFormatter = new HelpFormatter();
        helpFormatter.printHelp("java -jar compiler.jar [Options] File", options, true);
        System.exit(-1);
    } catch (final IOException e) {
        LOGGER.error(e.getLocalizedMessage());
        System.exit(-1);
    }
}

From source file:edu.mines.acmX.exhibit.runner.ModuleManagerRunner.java

/**
 * Main function for the ModuleManager framework. Creates an instance of
 * ModuleManager and runs it.//from   w w w. j  a v  a2s. c  o m
 * 
 * Arguments: The single argument that is needed is the path to a valid
 * module manager manifest file. This is specified using the --manifest arg.
 * For additional documentation on running the module manager please refer
 * to the wiki in Common.REPOSITORY
 */
public static void main(String[] args) {
    CommandLineParser cl = new GnuParser();
    CommandLine cmd;
    Options opts = generateCLOptions();
    try {
        cmd = cl.parse(opts, args);

        if (cmd.hasOption("help")) {
            printHelp(opts);
        } else {

            if (cmd.hasOption("manifest")) {
                ModuleManager.configure(cmd.getOptionValue("manifest"));
            } else {
                System.out.println("A Module Manager Manifest is required to run the module manager"
                        + "Please specify with the --manifest switch");
                System.exit(1);
            }
            ModuleManager m;
            m = ModuleManager.getInstance();
            //publicizeRmiInterface(m, RMI_REGISTRY_PORT);
            m.run();
        }

    } catch (ParseException e) {
        printHelp(opts);
        logger.error("Incorrect command line arguments");
        e.printStackTrace();
    } catch (ManifestLoadException e) {
        logger.fatal("Could not load the module manager manifest");
        e.printStackTrace();
    } catch (ModuleLoadException e) {
        logger.fatal("Could not load the default module");
        e.printStackTrace();
    }

}

From source file:com.redhat.akashche.wixgen.cli.Launcher.java

public static void main(String[] args) throws Exception {
    try {/*  w  w  w  .  jav a2 s. c  o  m*/
        CommandLine cline = new GnuParser().parse(OPTIONS, args);
        if (cline.hasOption(VERSION_OPTION)) {
            out.println(VERSION);
        } else if (cline.hasOption(HELP_OPTION)) {
            throw new ParseException("Printing help page:");
        } else if (1 == cline.getArgs().length && cline.hasOption(CONFIG_OPTION)
                && cline.hasOption(OUTPUT_OPTION) && !cline.hasOption(XSL_OPTION)) {
            WixConfig conf = parseConf(cline.getOptionValue(CONFIG_OPTION));
            Wix wix = new DirectoryGenerator().createFromDir(new File(cline.getArgs()[0]), conf);
            Marshaller marshaller = createMarshaller();
            writeXml(marshaller, wix, cline.getOptionValue(OUTPUT_OPTION), false);
            if (cline.hasOption(DIRECTORY_OPTION)) {
                Directory dir = findWixDirectory(wix);
                writeXml(marshaller, dir, cline.getOptionValue(DIRECTORY_OPTION), true);
            }
            if (cline.hasOption(FEATURE_OPTION)) {
                Feature feature = findWixFeature(wix);
                writeXml(marshaller, feature, cline.getOptionValue(FEATURE_OPTION), true);
            }
        } else if (1 == cline.getArgs().length && cline.hasOption(XSL_OPTION)
                && cline.hasOption(OUTPUT_OPTION)) {
            transformWithXsl(cline.getArgs()[0], cline.getOptionValue(XSL_OPTION),
                    cline.getOptionValue(OUTPUT_OPTION));
        } else {
            throw new ParseException("Incorrect arguments received!");
        }
    } catch (ParseException e) {
        HelpFormatter formatter = new HelpFormatter();
        out.println(e.getMessage());
        out.println(VERSION);
        formatter.printHelp("java -jar wixgen.jar input_dir -c config.json -o output.wxs", OPTIONS);
    }
}