Package joptsimple

Examples of joptsimple.OptionParser.printHelpOn()


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

    if (args.size() != 3) {
      err.println("Usage: uri protocol_file message_name (-data d | -file f)");
      p.printHelpOn(err);
      return 1;
    }

    URI uri = new URI(args.get(0));
    Protocol protocol = Protocol.parse(new File(args.get(1)));
View Full Code Here


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

    List<String> nargs = (List<String>)opts.nonOptionArguments();
    if (nargs.size() != 1) {
      err.println("Expected 1 arg: input_file");
      p.printHelpOn(err);
      return 1;
    }
    String schemastr = inschema.value(opts);
    String schemafile = file.value(opts);
    if (schemastr == null && schemafile == null) {
View Full Code Here

    }
    String schemastr = inschema.value(opts);
    String schemafile = file.value(opts);
    if (schemastr == null && schemafile == null) {
        err.println("Need an input schema file (--schema-file) or inline schema (--schema)");
        p.printHelpOn(err);
        return 1;
    }
    Schema schema = (schemafile != null)
        ? new Schema.Parser().parse(Util.openFromFS(schemafile))
        : new Schema.Parser().parse(schemastr);
View Full Code Here

    List<String> nargs = (List<String>)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;
    }
    CodecFactory codecFactory = Util.codecFactory(opts, codec, level);
 
View Full Code Here

        .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 = (List<String>)opts.nonOptionArguments();

    String schemastr = inschema.value(opts);
View Full Code Here

    String schemastr = inschema.value(opts);
    String schemafile = file.value(opts);
    if (schemastr == null && schemafile == null) {
        err.println("Need input schema (--schema-file) or (--schema)");
        p.printHelpOn(err);
        return 1;
    }
    Schema schema = (schemafile != null)
        ? new Schema.Parser().parse(Util.openFromFS(schemafile))
        : new Schema.Parser().parse(schemastr);
View Full Code Here

    String schemaFile = schemaFileOption.value(optionSet);
   
    if (nargs.size() != (schemaFile == null ? 2 : 1)) {
      err.println("jsontofrag --schema-file <file> [inline-schema] input-file");
      err.println("   converts JSON to Avro fragments.");
      optionParser.printHelpOn(err);
      err.println("   A dash '-' for input-file means stdin.");
      return 1;
    }
    Schema schema;
    String inputFile;
View Full Code Here

    String keyName = keyOption.value(opts);
   
    List<String> nargs = (List<String>)opts.nonOptionArguments();
    if (nargs.size() != 1) {
      err.println("Expected 1 arg: input_file");
      p.printHelpOn(err);
      return 1;
    }
    FsInput in = Util.openSeekableFromFS(args.get(0));
    DataFileReader<Void> reader =
      new DataFileReader<Void>(in, new GenericDatumReader<Void>());
View Full Code Here

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

    if (args.size() != 3) {
      err.println("Usage: uri protocol_file message_name (-data d | -file f)");
      p.printHelpOn(err);
      return 1;
    }

    URI uri = new URI(args.get(0));
    Protocol protocol = Protocol.parse(new File(args.get(1)));
View Full Code Here

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

    List<String> nargs = (List<String>)opts.nonOptionArguments();
    if (nargs.size() > 2) {
      err.println("Expected at most an input file and output file.");
      optParser.printHelpOn(err);
      return 1;
    }
    InputStream input = in;
    boolean inputNeedsClosing = false;
    if (nargs.size() > 0 && !nargs.get(0).equals("-")) {
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.