All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.weaverplatform.CliOptions Maven / Gradle / Ivy

package com.weaverplatform;

import org.apache.commons.cli.*;

/**
 * @author bastbijl, Sysunite 2017
 */
public class CliOptions {

  private CommandLineParser parser = new DefaultParser();
  private CommandLine cmd;

  public CliOptions(String[] args) {
    try {
      cmd = parser.parse(getOptions(), args);
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }

  private static Options getOptions() {
    Options options = new Options();
    options.addOption("z", "zip", false, "zip the payload before downloading or uploading");
    return options;
  }

  public static void printUsage() {

    HelpFormatter formatter = new HelpFormatter();
    formatter.printHelp(
    "\n   [ history|snaphot|restore|project-create|project-ready|project-wipe ]" +
    "\ne.g. $ weaver-cli http://localhost:9487 admin admin projectA restore < operations.json" +
    "\n" +
    "\nargs:"
    , getOptions());

    System.exit(0);
  }

  public boolean zip() {
    return cmd.hasOption("z");
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy