Package org.apache.commons.cli

Examples of org.apache.commons.cli.PosixParser


        options.addOption("cm", "conversion-mode", true, "Select conversion mode (only used for mode = c)\n1 = MARC21 to MARCXML\n2 = MARC21 to MODS\n3 = MARCXML to MODS\n4 = MARC21 to OLEF\n5 = MARCXML to OLEF\n6 = MODS to OLEF\n7 = refNum to OLEF\n8 = passthrough\n9 = DC to MODS\n10 = DC to OLEF");

        options.addOption( "iip", "input-id-prefix", true, "Prefix all input IDs with the given string, used to e.g. traverse down an XML tree." );
        options.addOption( "ct", "count-threshold", true, "Create new output file every <arg> entries." );

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

            if (args.length <= 0 || cmd.hasOption("h")) {
                HelpFormatter formatter = new HelpFormatter();
                formatter.printHelp("smt-cli", options);
View Full Code Here


     * @throws ParseException on failure to parse JSON input
     * @throws ConfigurationException on configuration error.
     */
    public static void main(String[] args) throws ParseException, ConfigurationException
    {
        CommandLineParser parser = new PosixParser();

        try
        {
            cmd = parser.parse(options, args);
        }
        catch (org.apache.commons.cli.ParseException e)
        {
            System.err.println(e.getMessage());
            printProgramUsage();
View Full Code Here

        options.addOption(OPTION_HEIGHT);
        return options;
    }

    public static void main(String[] arguments) throws Exception {
        CommandLineParser commandLineParser = new PosixParser();
        CommandLine commandLine = commandLineParser.parse(OPTIONS, arguments);

        int port = SocketOpenOfficeConnection.DEFAULT_PORT;
        if (commandLine.hasOption(OPTION_PORT.getOpt())) {
            port = Integer.parseInt(commandLine.getOptionValue(OPTION_PORT.getOpt()));
        }
View Full Code Here

  private static final Logger log = LoggerFactory.getLogger(ReportRunnerMain.class);

  public static void main(String... args) {
    Terminal.setupTerminal();

    CommandLineParser parser = new PosixParser();
    Options options = buildOptions();
    CommandLine cmd = null;
    try {
      cmd = parser.parse(options, args, true);
    } catch (ParseException pe) {
      printHelp(options);
      System.exit(2);
    }
View Full Code Here

  private static CommandLine parseCommandline(String args[])
      throws ParseException {
    options.addOption("t", "threads", true, "The number of concurrent theads" +
        " to use, one thread per file");

    CommandLineParser parser = new PosixParser();
    CommandLine cmd = parser.parse(options, args);

    return cmd;
  }
View Full Code Here

    if(args.length == 0) {
      printUsage();
      return;
    }
   
    CommandLineParser parser = new PosixParser();
    CommandLine cmd;

    try {
      cmd = parser.parse(options, args);
    } catch (ParseException e) {
      System.out.println("Error parsing command-line options: ");
      printUsage();
      return;
    }
View Full Code Here

    if(argv.length == 0) {
      printHelp();
      return -1;
    }

    CommandLineParser parser = new PosixParser();
    CommandLine cmd;

    try {
      cmd = parser.parse(options, argv);
    } catch (ParseException e) {
      System.out.println(
        "Error parsing command-line options: " + e.getMessage());
      printHelp();
      return -1;
View Full Code Here

     * @throws ParseException DOCUMENT_ME
     */
    public static void main( String[] args )
            throws ParseException
    {
        CommandLine cmdLine = new PosixParser().parse( CMD_LINE_OPTIONS, args, true );
        checkForRequiredOption( cmdLine, Opts.OUTPUT_DIR );
        checkForRequiredOption( cmdLine, Opts.CLASSPATH );
        File outputDir = new File( cmdLine.getOptionValue( Opts.OUTPUT_DIR ) );
        File[] classpathFiles = toFileArray( cmdLine.getOptionValue( Opts.CLASSPATH ) );

View Full Code Here

    private static Messages messages = new Messages(Cipher.class);

    public static void main(String[] args) throws SystemExitException {

        CommandLineParser parser = new PosixParser();

        // create the Options
        Options options = new Options();
        options.addOption(option("h", "help", "cmd.cipher.opt.help"));
        options.addOption(option("c", "cipher", "c", "cmd.cipher.opt.impl"));
        options.addOption(option("d", "decrypt", "cmd.cipher.opt.decrypt"));
        options.addOption(option("e", "encrypt", "cmd.cipher.opt.encrypt"));

        CommandLine line;
        try {
            // parse the command line arguments
            line = parser.parse(options, args);
        } catch (ParseException exp) {
            help(options);
            throw new SystemExitException(-1);
        }
View Full Code Here

     */
    public static void main(String[] args) throws IOException, ConfigurationException
    {
        String usage = String.format("Usage: %s <sstable> [-k key [-k key [...]] -x key [-x key [...]]]%n", SSTableExport.class.getName());

        CommandLineParser parser = new PosixParser();
        try
        {
            cmd = parser.parse(options, args);
        }
        catch (ParseException e1)
        {
            System.err.println(e1.getMessage());
            System.err.println(usage);
View Full Code Here

TOP

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

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.