Package joptsimple

Examples of joptsimple.OptionSet.nonOptionArguments()


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

    if (nargs.size() != 1) {
      printHelp(err);
      err.println();
      optionParser.printHelpOn(err);
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 = (List<String>)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

    OptionSpec<String> data =
      p.accepts("data", "JSON-encoded request parameters.")
      .withRequiredArg()
      .ofType(String.class);
    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;
View Full Code Here

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

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

        p.accepts("schema", "Schema")
        .withOptionalArg()
        .ofType(String.class);
    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;
    }
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 = (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;
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 = (List<String>)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 = (List<String>)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

        .accepts("schema-file", "File containing schema, must not occur with inline schema.")
        .withOptionalArg()
        .ofType(String.class);
   
    OptionSet optionSet = optionParser.parse(args.toArray(new String[0]));
    List<String> nargs = (List<String>)optionSet.nonOptionArguments();
    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.");
View Full Code Here

        .withOptionalArg()
        .ofType(String.class);
    OptionSet opts = p.parse(args.toArray(new String[0]));
    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;
    }
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.