Package joptsimple

Examples of joptsimple.OptionParser.printHelpOn()


        .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();

    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

    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");
      err.println("   converts Avro data file to JSON.");
      optionParser.printHelpOn(err);
      return 1;
    }

    GenericDatumReader<Object> reader = new GenericDatumReader<Object>();
    FileReader<Object> fileReader =
View Full Code Here

    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.");
      optionParser.printHelpOn(err);
      err.println("   A dash '-' for input-file means stdin.");
      return 1;
    }
    Schema schema;
    String inputFile;
View Full Code Here

     
    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;
    }

    BufferedInputStream inStream = Util.fileOrStdin(args.get(0), stdin);
    BufferedOutputStream outStream = Util.fileOrStdout(args.get(1), out);
View Full Code Here

    DataFileStream<Object> fileReader =
        new DataFileStream<Object>(inStream, reader);

    if (!fileReader.getSchema().equals(new Schema.Parser().parse(TEXT_FILE_SCHEMA))) {
      err.println("Avro file is not generic text schema");
      p.printHelpOn(err);
      fileReader.close();
      return 1;
    }
   
    while (fileReader.hasNext()) {
View Full Code Here

    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;
    }
    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>)optionSet.nonOptionArguments();

    if (nargs.size() != 1) {
      printHelp(err);
      err.println();
      optionParser.printHelpOn(err);
      return 1;
    }

    BufferedInputStream inStream = Util.fileOrStdin(nargs.get(0), stdin);
View Full Code Here

    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.");
      optionParser.printHelpOn(err);
      err.println("   A dash '-' for input-file means stdin.");
      return 1;
    }
    Schema schema;
    String inputFile;
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.