Package joptsimple

Examples of joptsimple.OptionSet.nonOptionArguments()


      p.accepts("codec", "Compression codec")
      .withRequiredArg()
      .defaultsTo("null")
      .ofType(String.class);
    OptionSet opts = p.parse(args.toArray(new String[0]));
    if (opts.nonOptionArguments().size() != 2) {
      err.println("Usage: inFile outFile (filenames or '-' for stdin/stdout)");
      p.printHelpOn(err);
      return 1;
    }
    args = opts.nonOptionArguments();
View Full Code Here


    if (opts.nonOptionArguments().size() != 2) {
      err.println("Usage: inFile outFile (filenames or '-' for stdin/stdout)");
      p.printHelpOn(err);
      return 1;
    }
    args = opts.nonOptionArguments();

    DataFileStream<Object> reader =
      new DataFileStream(Util.fileOrStdin(args.get(0), stdin),
                         new GenericDatumReader<Object>());
    OutputStream outs = Util.fileOrStdout(args.get(1), out);
View Full Code Here

    OptionSpec<Integer> level = Util.compressionLevelOption(p);
    OptionSpec<String> codec = Util.compressionCodecOption(p);

    OptionSet opts = p.parse(args.toArray(new String[0]));

    List<String> nargs = opts.nonOptionArguments();
    if (nargs.size() != 2) {
      err.println("Expected 2 args: from_file to_file (local filenames," +
          " Hadoop URI's, or '-' for stdin/stdout");
      p.printHelpOn(err);
      return 1;
View Full Code Here

    OptionSpec<String> inschema =
        p.accepts("schema", "Schema")
        .withOptionalArg()
        .ofType(String.class);
    OptionSet opts = p.parse(args.toArray(new String[0]));
    if (opts.nonOptionArguments().size() != 1) {
      err.println("Usage: outFile (filename or '-' for stdout)");
      p.printHelpOn(err);
      return 1;
    }
    args = opts.nonOptionArguments();
View Full Code Here

    if (opts.nonOptionArguments().size() != 1) {
      err.println("Usage: outFile (filename or '-' for stdout)");
      p.printHelpOn(err);
      return 1;
    }
    args = opts.nonOptionArguments();

    String schemastr = inschema.value(opts);
    String schemafile = file.value(opts);
    if (schemastr == null && schemafile == null) {
        err.println("Need input schema (--schema-file) or (--schema)");
View Full Code Here

    OptionSpec<Void> prettyOption = optionParser
        .accepts("pretty", "Turns on pretty printing.");

    OptionSet optionSet = optionParser.parse(args.toArray(new String[0]));
    Boolean pretty = optionSet.has(prettyOption);
    List<String> nargs = optionSet.nonOptionArguments();

    if (nargs.size() != 1) {
      // Unlike other commands, "-" can't be used for stdin, because
      // we can only use seekable files.
      err.println("tojson --pretty input-file");
View Full Code Here

        .withOptionalArg()
        .ofType(String.class);
   
    OptionSet optionSet = optionParser.parse(args.toArray(new String[0]));
    Boolean noPretty = optionSet.has(noPrettyOption);
    List<String> nargs = optionSet.nonOptionArguments();
    String schemaFile = schemaFileOption.value(optionSet);
   
    if (nargs.size() != (schemaFile == null ? 2 : 1)) {
      err.println("fragtojson --no-pretty --schema-file <file> [inline-schema] input-file");
      err.println("   converts Avro fragments to JSON.");
View Full Code Here

      .withRequiredArg()
      .ofType(Double.class)
      .defaultsTo(new Double(1));

    OptionSet opts = optParser.parse(args.toArray(new String[0]));
    List<String> nargs = opts.nonOptionArguments();
    if (nargs.size() < 2) {
      printHelp(out);
      return 0;
    }
   
View Full Code Here

  public int run(InputStream stdin, PrintStream out, PrintStream err,
      List<String> args) throws Exception {
     
    OptionParser p = new OptionParser();
    OptionSet opts = p.parse(args.toArray(new String[0]));
    if (opts.nonOptionArguments().size() != 2) {
      err.println("Expected 2 args: from_file to_file (filenames or '-' for stdin/stdout");
      p.printHelpOn(err);
      return 1;
    }
View Full Code Here

        p.accepts("schema", "Schema")
        .withOptionalArg()
        .ofType(String.class);
    OptionSet opts = p.parse(args.toArray(new String[0]));

    List<String> nargs = opts.nonOptionArguments();
    if (nargs.size() != 1) {
      err.println("Expected 1 arg: input_file");
      p.printHelpOn(err);
      return 1;
    }
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.