@SuppressWarnings("static-access")
  public static void main(String[] args) throws Exception {
    Options options = new Options();
    options.addOption(
        OptionBuilder.withArgName("path")
            .hasArg()
            .withDescription("data file with tweet ids")
            .create(DATA_OPTION));
    options.addOption(
        OptionBuilder.withArgName("path")
            .hasArg()
            .withDescription("output file (*.gz)")
            .create(OUTPUT_OPTION));
    options.addOption(NOFOLLOW_OPTION, NOFOLLOW_OPTION, false, "don't follow 301 redirects");

    CommandLine cmdline = null;
    CommandLineParser parser = new GnuParser();
    try {
      cmdline = parser.parse(options, args);
    } catch (ParseException exp) {
      System.err.println("Error parsing command line: " + exp.getMessage());
      System.exit(-1);
    }

    if (!cmdline.hasOption(DATA_OPTION) || !cmdline.hasOption(OUTPUT_OPTION)) {
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp(ReadStatuses.class.getName(), options);
      System.exit(-1);
    }

    String data = cmdline.getOptionValue(DATA_OPTION);
    String output = cmdline.getOptionValue(OUTPUT_OPTION);
    boolean noFollow = cmdline.hasOption(NOFOLLOW_OPTION);
    new AsyncEmbeddedJsonStatusBlockCrawler(new File(data), output, noFollow).fetch();
  }
Example #2
0
  private static boolean setOptions(String[] lcommand) {

    Options loptions = new Options();
    loptions.addOption(new Option("d", "debug", false, "print debug information (highly verbose)"));
    loptions.addOption(new Option("o", "stdout", false, "print output files to standard output"));
    loptions.addOption(new Option("w", "warning", false, "print warning messages"));

    CommandLineParser clparser = new PosixParser();
    try {
      cmd = clparser.parse(loptions, lcommand);
    } catch (org.apache.commons.cli.ParseException e) {
      String mytoolcmd = "java -jar stave.jar";
      String myoptlist = " <options> <source files>";
      String myheader = "Convert JavaParser's AST to OpenJDK's AST";
      String myfooter = "More info: https://github.com/pcgomes/javaparser2jctree";

      HelpFormatter formatter = new HelpFormatter();
      // formatter.printUsage( new PrintWriter(System.out,true), 100, "java -jar synctask.jar",
      // loptions );
      // formatter.printHelp( mytoolcmd + myoptlist, myheader, loptions, myfooter, false);
      formatter.printHelp(mytoolcmd + myoptlist, loptions, false);
      return (false);
    }

    return (true);
  }
 private void printHelp() {
   final HelpFormatter formatter = new HelpFormatter();
   // formatter.setLeftPadding(2);
   // formatter.setDescPadding(2);
   // formatter.setWidth(80);
   formatter.printHelp("aws", m_options);
 }
Example #4
0
  private static void printHelp(Options options) {
    String header = "Enter some parameters\n\n";
    String footer = "\nPlease report issues at [email protected]";

    HelpFormatter helpFormatter = new HelpFormatter();
    helpFormatter.printHelp("aaaJava", header, options, footer, true);
  }
Example #5
0
  /**
   * Parse arguments
   *
   * @param args
   */
  private void commandLineParser(String[] args) throws ParseException {
    options = new Options();
    options.addOption("help", false, "print this message");
    options.addOption(
        OPTION_CARBON_PORT,
        true,
        "specify port for graphite/carbon events - (" + DEFAULT_PORT_CARBON + " by default)");
    options.addOption(
        OPTION_STATSD_PORT,
        true,
        "specify port for statsD events - (" + DEFAULT_PORT_STATSD + " by default)");
    options.addOption(
        OPTION_WEBSERVER_PORT,
        true,
        "specify port for http server - (" + DEFAULT_PORT_WEBSERVER + " by default)");
    options.addOption(
        OPTION_CARBON_ONLY, false, "start TCP socket only for graphite/carbon events");
    options.addOption(OPTION_STATSD_ONLY, false, "start UDP socket only for statsd events");
    options.addOption(OPTION_NO_WEBSERVER, false, "don't start webserver");
    options.addOption(OPTION_HAWTIO, false, "start hawtio in webserver");

    options.addOption(OPTION_BACKEND, true, "backend implementation available : " + getBackends());
    options.addOption(OPTION_WEBSERVER_WEBROOT, true, "HTTP base resource (must be a path)");

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

    if (cmd.hasOption("help")) {
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp("java -jar bigloupe-chart.jar [options]", options);
      System.exit(0);
    }
  }
Example #6
0
 /** Check command line arguments. */
 public void checkComanLineArgs() {
   options.addOption(COMMANDS_MANAGER_U, COMMANDS_MANAGER_USER, true, USER_DESCRIPTION);
   options.addOption(COMMANDS_MANAGER_P, COMMANDS_MANAGER_PASSWORD, true, PASSWORD_DESCRIPTION);
   options.addOption(
       COMMANDS_MANAGER_FETCH_F, COMMANDS_MANAGER_FETCH_FILE, false, FETCH_FILE_DESCRIPTION);
   options.addOption(COMMANDS_MANAGER_H, COMMANDS_MANAGER_HELP, false, HELP_DESCRIPTION);
   CommandLineParser parser = new PosixParser();
   CommandLine cmd;
   try {
     cmd = parser.parse(options, args);
     if (cmd.hasOption(COMMANDS_MANAGER_U) && cmd.hasOption(COMMANDS_MANAGER_P)
         || cmd.hasOption(COMMANDS_MANAGER_USER) && cmd.hasOption(COMMANDS_MANAGER_PASSWORD)) {
       setName(cmd.getOptionValue(COMMANDS_MANAGER_U));
       setPass(cmd.getOptionValue(COMMANDS_MANAGER_P));
     } else if (cmd.hasOption(COMMANDS_MANAGER_FETCH_F)) {
       isGetLink = false;
     } else if (cmd.hasOption(COMMANDS_MANAGER_H)) {
       HelpFormatter formatter = new HelpFormatter();
       formatter.printHelp(COMMANDS_MANAGER_H, options);
       System.exit(0);
     }
   } catch (ParseException e) {
     // e.printStackTrace();
     LOGGER.error(e);
   }
 }
Example #7
0
  @Override
  protected int run(CommandLine cmd) throws Exception {
    List args = cmd.getArgList();

    if (args.contains(CMD_ACTION_CREATE)) {
      return create(cmd);
    }
    if (args.contains(CMD_ACTION_LIST)) {
      return list(cmd);
    }
    if (args.contains(CMD_ACTION_UPDATE_PASSWORD)) {
      return updatePassword(cmd);
    }
    if (args.contains(CMD_ACTION_DELETE)) {
      return delete(cmd);
    }
    if (args.contains(CMD_ACTION_SET_PRIVILEGES)) {
      return setPrivileges(cmd);
    }
    if (args.contains(CMD_ACTION_SET_AUTHORIZATIONS)) {
      return setAuthorizations(cmd);
    }

    String actions = StringUtils.join(getActions(), " | ");
    HelpFormatter formatter = new HelpFormatter();
    formatter.printHelp(UserAdmin.class.getSimpleName() + " < " + actions + " >", getOptions());
    return -1;
  }
Example #8
0
  public static void main(String[] args) throws ConfigurationException, ParseException {
    Configuration config = new PropertiesConfiguration("application.properties");

    // Options
    Options options = setUpOptions();

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

    // TODO Anatoli: it makes sense to add strict validation
    for (Option option : cmd.getOptions()) {
      if (StringUtils.isNotBlank(option.getValue())) {
        config.addProperty(option.getLongOpt(), option.getValue());
      }
    }
    if (cmd.hasOption('h')) {
      HelpFormatter formatter = new HelpFormatter();
      formatter.setWidth(120);
      formatter.printHelp(
          "java -Dlogback.configurationFile=logback.xml -jar whatIsOilPriceNow.jar [options]",
          options);
      return;
    }

    RockNRoller roller = new RockNRoller(config);
    roller.startMainLoop();
  }
  private void processCommandLine(String[] args) throws ParseException {
    Option certificateFilenameOption;
    Options commandLineOptions;
    CommandLineParser clp;
    CommandLine cl;

    certificateFilenameOption = null;
    commandLineOptions = null;
    clp = null;
    cl = null;

    certificateFilenameOption =
        new Option("f", "file", true, "file name containing certificate to be imported");
    certificateFilenameOption.setRequired(true);
    certificateFilenameOption.setArgs(1);
    certificateFilenameOption.setOptionalArg(false);
    certificateFilenameOption.setArgName("filename");

    commandLineOptions = new Options();
    commandLineOptions.addOption(certificateFilenameOption);

    clp = new PosixParser();

    try {
      cl = clp.parse(commandLineOptions, args);

      setCertificateFilename(IMPORT_AREA_DIRECTORY + "/" + cl.getOptionValue('f'));
    } catch (ParseException pe) {
      HelpFormatter formatter = new HelpFormatter();

      formatter.printHelp(APPLICATION_NAME, commandLineOptions, true);

      throw pe;
    }
  }
Example #10
0
  @Override
  public int run(String[] args) throws Exception {

    Options options = new Options();
    options.addOption("c", "concurrent", false, "run concurrently with generation");

    GnuParser parser = new GnuParser();
    CommandLine cmd = null;
    try {
      cmd = parser.parse(options, args);
      if (cmd.getArgs().length != 4) {
        throw new ParseException(
            "Did not see expected # of arguments, saw " + cmd.getArgs().length);
      }
    } catch (ParseException e) {
      System.err.println("Failed to parse command line " + e.getMessage());
      System.err.println();
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp(getClass().getSimpleName() + " <output dir> <num reducers>", options);
      System.exit(-1);
    }

    String outputDir = cmd.getArgs()[0];
    int numReducers = Integer.parseInt(cmd.getArgs()[1]);
    String accessKey = cmd.getArgs()[2];
    String secretKey = cmd.getArgs()[3];

    return run(outputDir, numReducers, cmd.hasOption("c"), accessKey, secretKey);
  }
Example #11
0
  /** Option help. */
  private void optionHelp() {
    System.out.println("option -h. Exit Programm");

    final HelpFormatter formatter = new HelpFormatter();
    formatter.printHelp("movsim", options);
    System.exit(0);
  }
  public static void main(String[] args) {
    options = createOptions();

    CommandLineParser parser = new GnuParser();
    try {
      CommandLine line = parser.parse(options, args);

      String complexFile = line.getOptionValue("complex");
      String pointsFile = line.getOptionValue("points");

      String outputFile = null;
      if (line.hasOption("destination")) {
        outputFile = line.getOptionValue("destination");
      } else {
        outputFile = FileManager.generateUniqueFileName() + ".pov";
      }

      renderFromFiles(complexFile, pointsFile, outputFile);
    } catch (ParseException exp) {
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp("plex-viewer", options);
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
Example #13
0
  public void displayHelp() {
    System.out.println();

    HelpFormatter formatter = new HelpFormatter();

    formatter.printHelp("java -jar cli-jar-name [options]", "\nOptions:", options, "\n");
  }
Example #14
0
 private static void printHelp(Options options) {
   HelpFormatter formatter = new HelpFormatter();
   formatter.printHelp(
       "mount.sdfs -m <mount point> "
           + "-r <path to chunk store routing file> -[v|vc] <volume name to mount | path to volume config file> ",
       options);
 }
Example #15
0
  protected void usage(ParseException e, boolean showHiddenOptions) {
    if (e != null) {
      System.err.println("Error parsing command line arguments: " + e.getMessage());
    }

    Options opts = showHiddenOptions ? getAllOptions() : mOptions;
    PrintWriter pw = new PrintWriter(System.err, true);
    HelpFormatter formatter = new HelpFormatter();
    formatter.printHelp(
        pw,
        formatter.getWidth(),
        getCommandUsage(),
        null,
        opts,
        formatter.getLeftPadding(),
        formatter.getDescPadding(),
        null);
    pw.flush();

    String trailer = getTrailer();
    if (trailer != null && trailer.length() > 0) {
      System.err.println();
      System.err.println(trailer);
    }
  }
Example #16
0
  /**
   * Cirrus main entry point.
   *
   * @param args the command line arguments.
   */
  public static void main(final String[] args) {

    if (args.length < 1) {
      LOG.error(MessageCatalog.WRONG_ARGS_SIZE);
      System.exit(1);
    }

    final Command command = COMMAND_REGISTRY.get(args[0]);
    if (command == null) {
      LOG.error(MessageCatalog._00001__UNKNOWN_COMMAND, args[0]);
      System.exit(1);
    }

    final CommandLineParser parser = new BasicParser();

    try {
      final CommandLine commandLine = parser.parse(command.getOptions(), args);
      command.execute(commandLine);
    } catch (final MissingOptionException exception) {
      command._log.error(MessageCatalog._00028_CL_PARSER_FAILURE, exception.getMessage());
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp("cirrus <command> <options>", command.getOptions());
      System.exit(1);
    } catch (final ParseException exception) {
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp("cirrus <command> <options>", command.getOptions());
      System.exit(1);
    }
  }
Example #17
0
 private static final void printHelp(PrintStream out, Options options, ParseException e) {
   if (e != null) {
     out.println(NAME + ": Command line error - " + e.getMessage());
   }
   HelpFormatter helpFormatter = new HelpFormatter();
   helpFormatter.printHelp(NAME, options);
 }
Example #18
0
  public static void main(String[] args) throws Exception {
    Options options = new Options();
    options.addOption("i", "input-file", true, "input data file.");
    options.addOption("o", "output-file", true, "output file.");
    options.addOption("h", "help", false, "display help document");
    CommandLineParser parser = new PosixParser();
    CommandLine cmd = parser.parse(options, args);
    String inputFile = null;
    String outputFile = null;
    if (cmd.hasOption("i")) {
      inputFile = cmd.getOptionValue("i");
    }
    if (cmd.hasOption("o")) {
      outputFile = cmd.getOptionValue("o");
    }
    boolean help = false;
    if (inputFile == null || outputFile == null) {
      help = true;
    }
    if (cmd.hasOption("h") || help) {
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp("docsim stat", options);
      return;
    }
    // DocSimStatTest test = new DocSimStatTest("");
    // test.notestSummary();

    DocSimLatticeStatistics stat = BasicStatisticsFormatter.getStatFromFile(inputFile);
    BasicStatisticsFormatter.avgCalcBySize2File(stat, outputFile);
  }
Example #19
0
  public void dispatch(String[] args, FTPSession ftp) {

    CommandLine line = ArgParser.parse(args);

    if (args.length <= 0 || line == null || line.hasOption('h') || line.hasOption("help")) {
      // determine whether or not to print usage/help

      HelpFormatter help = new HelpFormatter();
      help.printHelp("FTPClient", ArgParser.options());
    } else {
      // otherwise handle all other options

      if (line.hasOption('C') || line.hasOption("connect")) {
        // handle server connection option
        commands.connect(ftp, line.getOptionValue('C'));
      }

      if (line.hasOption("l") || line.hasOption("list")) {
        if (line.hasOption("L") || line.hasOption("local")) {
          // handle option to list local files
          commands.listLocalWorkingDir(ftp);
        } else {
          // handle option to list remote files
          commands.listRemoteWorkingDir(ftp);
        }
      }

      if (line.hasOption('g') || line.hasOption("get")) {
        // handle getting a file on remote
        commands.getRemoteFile(ftp, line.getOptionValue('g'));
      }

      if (line.hasOption('p') || line.hasOption("put")) {
        // handle putting a file on remote
        commands.putRemoteFile(ftp, line.getOptionValues('p'));
      }

      if (line.hasOption('i') || line.hasOption("dir")) {
        // create directory on the ftp server
        commands.createRemoteDirectory(ftp, line.getOptionValue('i'));
      }

      if (line.hasOption('m') || line.hasOption("modify")) {
        // modify remote file permissions
        commands.changeRemotePermissions(ftp, line.getOptionValues('m'));
      }

      if (line.hasOption('d') || line.hasOption("delete")) {
        if (line.hasOption('R') || line.hasOption("recursive")) {
          // TODO: handle delete remote directory
        } else {
          // delete file on remote server
          commands.deleteRemoteFile(ftp, line.getOptionValue('d'));
        }
      }

      commands.exit(ftp);
    }
  }
Example #20
0
  public static void main(String[] argv) throws Exception {
    Options options = new Options();
    options.addOption("js", false, "Create f5less.js");
    options.addOption("p", "port", true, "ws:reload websocket server port");
    options.addOption("h", "host", true, "ws:reload websocket server host");
    options.addOption("d", "debounce", true, "debouncing for commands");

    CommandLine cmdLine = new PosixParser().parse(options, argv);
    String[] args = cmdLine.getArgs();

    if (cmdLine.hasOption("js")) {
      Files.copy(
          TheBuilder.class.getClassLoader().getResourceAsStream("f5less.js"),
          Paths.get("./f5less.js"),
          StandardCopyOption.REPLACE_EXISTING);
      System.out.println(
          "\n  f5less.js created...\n  put the following\n"
              + "     <script type=\"text/javascript\" src=\"f5less.js\"></script>\n"
              + "     <script type=\"text/javascript\">f5less.connect()</script>\n"
              + "  in the page for which you want automatic reloading (assuming 'f5less.js' is in the same directory)\n");
    }

    if (args.length < 2) {
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp("f5less [options] path1 cmd1 path2 cmd2 ...", options);
      System.exit(-1);
    }

    final List<String> reloadPaths = new LinkedList<String>();
    final int commandsDebounce = Integer.parseInt(cmdLine.getOptionValue("d", "100"));

    for (int i = 0; i < args.length / 2; i++) {
      final String path = args[i * 2];
      final String rawCmd = args[i * 2 + 1];

      if (rawCmd.equals("ws:reload")) reloadPaths.add(path);
      else Watcher.register(path, new CommandListener(path, rawCmd, commandsDebounce));
    }

    ReloadServer reloadServer = null;
    if (!reloadPaths.isEmpty()) {
      reloadServer =
          new ReloadServer(
              cmdLine.getOptionValue("h", "localhost"),
              Integer.parseInt(cmdLine.getOptionValue("p", "9999")),
              commandsDebounce + 50);
      reloadServer.monitor(reloadPaths);
    }

    System.out.println("Press enter to exit...");
    System.in.read();

    if (reloadServer != null) reloadServer.stop();

    Watcher.stop();
    CommandListener.stop();

    System.out.println("Bye bye");
  }
 protected static void printHelp() {
   HelpFormatter formatter = new HelpFormatter();
   formatter.printHelp(
       Messages.getInstance().getString("CommandLineProcessor.INFO_PRINTHELP_CMDLINE"),
       Messages.getInstance().getString("CommandLineProcessor.INFO_PRINTHELP_HEADER"),
       options,
       Messages.getInstance().getString("CommandLineProcessor.INFO_PRINTHELP_FOOTER"));
 }
Example #22
0
 private void printUsage(boolean tsqlMode) {
   if (!tsqlMode) {
     HelpFormatter formatter = new HelpFormatter();
     formatter.printHelp("getconf <key> [options]", options);
   }
   System.out.println(
       defaultLeftPad + "key" + defaultDescPad + "gets a specific key from the configuration");
 }
Example #23
0
  /** Print usage information to provided OutputStream. */
  public static void printUsage() {
    String applicationName = MetaExtractionMain.class.getName();

    PrintWriter writer = new PrintWriter(System.out);
    HelpFormatter usageFormatter = new HelpFormatter();
    usageFormatter.printUsage(writer, 80, applicationName, cliOptions);
    writer.close();
  }
Example #24
0
 private static void printHelp(Options options) {
   HelpFormatter formatter = new HelpFormatter();
   formatter.printHelp(
       "java "
           + CytoscapeHelperImpl.class.getName()
           + " generate graphs and node lists for cytoscape",
       options);
 }
Example #25
0
 /** Write usage to console. */
 private static void logUsage(Options options) {
   HelpFormatter formatter = new HelpFormatter();
   StringWriter sw = new StringWriter();
   PrintWriter pw = new PrintWriter(sw);
   String syntax = UrlTracker.class.getName() + " [<options>]";
   formatter.printHelp(pw, 100, syntax, "options:", options, 0, 2, null);
   System.out.println(sw.toString());
 }
Example #26
0
  @SuppressWarnings("static-access")
  public static void main(String[] args) throws Exception {
    Options options = new Options();
    options.addOption(
        OptionBuilder.withArgName("name")
            .hasArg()
            .withDescription("name of the archive")
            .create(NAME_OPTION));
    options.addOption(
        OptionBuilder.withArgName("path")
            .hasArg()
            .withDescription("WARC files location")
            .create(DIR_OPTION));
    options.addOption(
        OptionBuilder.withArgName("n")
            .hasArg()
            .withDescription("Start from the n-th WARC file")
            .create(START_OPTION));

    options.addOption("create", false, "create new table");
    options.addOption("append", false, "append to existing table");

    CommandLine cmdline = null;
    CommandLineParser parser = new GnuParser();
    try {
      cmdline = parser.parse(options, args);
    } catch (ParseException exp) {
      System.err.println("Error parsing command line: " + exp.getMessage());
      System.exit(-1);
    }

    if (!cmdline.hasOption(DIR_OPTION) || !cmdline.hasOption(NAME_OPTION)) {
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp(IngestFiles.class.getCanonicalName(), options);
      System.exit(-1);
    }

    if (!cmdline.hasOption(CREATE_OPTION) && !cmdline.hasOption(APPEND_OPTION)) {
      System.err.println(
          String.format("Must specify either -%s or -%s", CREATE_OPTION, APPEND_OPTION));
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp(IngestFiles.class.getCanonicalName(), options);
      System.exit(-1);
    }

    String path = cmdline.getOptionValue(DIR_OPTION);
    File inputFolder = new File(path);

    int i = 0;
    if (cmdline.hasOption(START_OPTION)) {
      i = Integer.parseInt(cmdline.getOptionValue(START_OPTION));
    }

    String name = cmdline.getOptionValue(NAME_OPTION);
    boolean create = cmdline.hasOption(CREATE_OPTION);
    IngestFiles load = new IngestFiles(name, create);
    load.ingestFolder(inputFolder, i);
  }
Example #27
0
  /**
   * Called only in standalone mode
   *
   * @param args
   */
  private void startMetricsServer(String[] args) {
    AnsiConsole.systemInstall();
    String version =
        ((MetricsServer.class.getPackage().getImplementationVersion() != null)
            ? MetricsServer.class.getPackage().getImplementationVersion()
            : "'undefined'");
    System.out.println(
        ansi()
            .fg(RED)
            .render("@|bold Starting BigLoupe Metrics server version |@")
            .fg(GREEN)
            .a(version)
            .fg(WHITE));
    logger.info("Starting BigLoupe Metrics server version " + version);

    try {
      commandLineParser(args);
      applyCommonOption();

      Server server = startWebServer(version);

      keepAliveLatch = new CountDownLatch(1);
      // keep this thread alive (non daemon thread) until we shutdown
      Runtime.getRuntime()
          .addShutdownHook(
              new Thread() {
                @Override
                public void run() {
                  keepAliveLatch.countDown();
                }
              });

      keepAliveThread =
          new Thread(
              new Runnable() {
                @Override
                public void run() {
                  try {
                    keepAliveLatch.await();
                  } catch (InterruptedException e) {
                    // bail out
                  }
                }
              },
              "BigLoupe metrics-server[keepAlive/" + version + "]");
      keepAliveThread.setDaemon(false);
      keepAliveThread.start();

      Runtime.getRuntime().addShutdownHook(new Thread(new MetricsServerCleaner(server)));
    } catch (ParseException e) {
      System.out.println(e.getMessage());
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp("java -jar bigloupe-chart.jar [options]", options);
      System.exit(-1);
    } catch (Exception e) {
      throw new IllegalArgumentException(e);
    }
  }
Example #28
0
 private static void print_help() {
   String header =
       "MapCore application. CMPUT 402 Winter 2016 Project.\n"
           + "Must run as either importer, simulator, webapi or converter.\n\n";
   String footer =
       "\nPlease report issues at\nhttps://github.com/cmput402w2016/CMPUT402W16T1/issues";
   HelpFormatter formatter = new HelpFormatter();
   formatter.printHelp("MapCore", header, options, footer, true);
 }
Example #29
0
 private void printUsage(Options options, Boolean andExit) {
   String HEADER = "";
   String USAGE = "java -jar QuickFormatter.jar -i inputfile [-o outputfile] [-d delimiter] [-x]";
   String FOOTER = "\n\n";
   HelpFormatter helpFormatter = new HelpFormatter();
   helpFormatter.setWidth(100);
   helpFormatter.printHelp(USAGE, HEADER, options, FOOTER);
   if (andExit) System.exit(0);
 }
Example #30
0
 private CommandLine getCommandLine() {
   GnuParser parser = new GnuParser();
   try {
     return parser.parse(getCommandOptions(), getInitArgs(), true);
   } catch (ParseException ex) {
     HelpFormatter formatter = new HelpFormatter();
     formatter.printHelp(getClass().getName(), getCommandOptions());
     throw new RuntimeException("Could not parse command line for: " + getClass().getName(), ex);
   }
 }