Examples of JCommander


Examples of com.beust.jcommander.JCommander

*/
public class Main {
    public static void main(String args[])
    {       
        Options options = new Options();
        JCommander jc = new JCommander(options);
       
        CreateRaceCommand createRace = new CreateRaceCommand();
        jc.addCommand("createrace", createRace);
        UpdateRaceCommand updateRace = new UpdateRaceCommand();
        jc.addCommand("updaterace", updateRace);
       
        CreateSkillCommand createSkill = new CreateSkillCommand();
        jc.addCommand("createskill", createSkill);
        UpdateSkillCommand updateSkill = new UpdateSkillCommand();
        jc.addCommand("updateskill", updateSkill);
       
        FindCommand findCommand = new FindCommand();
        jc.addCommand("find", findCommand);
        DeleteCommand deleteCommand = new DeleteCommand();
        jc.addCommand("delete", deleteCommand);
       
        if(args.length < 1)
        {
            jc.usage();
            System.exit(1);
        }
       
        try
        {
            jc.parse(args);
        }
        catch(Exception ex)
        {
            System.out.println(ex.getMessage());
            System.exit(1);
        }
       
        if(options.isHelp())
        {
            jc.usage();
            System.exit(0);
        }
       
        try
        {
            String url = "http://" + options.getServer() + ":" + options.getPort() + "/pa165/api/";
            SkillService ss = new SkillServiceImpl(url+"skill/");
            RaceService rs = new RaceServiceImpl(url+"race/");           
            switch(jc.getParsedCommand())
            {
                case "createrace":
                    rs.create(
                            rs.createNewRace(
                                createRace.getName(),
View Full Code Here

Examples of com.beust.jcommander.JCommander

  static long currentlyRead = 0;
  public static void main(String[] args) throws IOException, RecognitionException {
    final long starttime = System.nanoTime();
    try {
      Args parsedArgs = new Args();
      new JCommander(parsedArgs, args);
      File mySqlFile = new File(parsedArgs.mySqlFile);
      File outDir = new File(parsedArgs.outDir);
     
      Thread monitor = new Thread("Stream monitor") {
        public void run() {
View Full Code Here

Examples of com.beust.jcommander.JCommander

  static class PrintOpts {
  }
 
  public static void main(String[] args) throws Exception {
    Help opts = new Help();
    JCommander jc = new JCommander(opts);
    jc.setProgramName(Admin.class.getName());
    jc.addCommand("fail", new FailOpts());
    jc.addCommand("delete", new DeleteOpts());
    jc.addCommand("print", new PrintOpts());
    jc.parse(args);
    if (opts.help || jc.getParsedCommand() == null) {
      jc.usage();
      System.exit(-1);
    }
   
    AdminUtil<Master> admin = new AdminUtil<Master>();
   
    Instance instance = HdfsZooInstance.getInstance();
    String path = ZooUtil.getRoot(instance) + Constants.ZFATE;
    String masterPath = ZooUtil.getRoot(instance) + Constants.ZMASTER_LOCK;
    IZooReaderWriter zk = ZooReaderWriter.getRetryingInstance();
    ZooStore<Master> zs = new ZooStore<Master>(path, zk);
   
    if (jc.getParsedCommand().equals("fail")) {
      if (!admin.prepFail(zs, zk, masterPath, args[1])) {
        System.exit(1);
      }
    } else if (jc.getParsedCommand().equals("delete")) {
      if (!admin.prepDelete(zs, zk, masterPath, args[1])) {
        System.exit(1);
      }
      admin.deleteLocks(zs, zk, ZooUtil.getRoot(instance) + Constants.ZTABLE_LOCKS, args[1]);
    } else if (jc.getParsedCommand().equals("print")) {
      admin.print(zs, zk, ZooUtil.getRoot(instance) + Constants.ZTABLE_LOCKS);
    }
  }
View Full Code Here

Examples of com.beust.jcommander.JCommander

   
    Matcher rowMatcher = null;
    KeyExtent ke = null;
    Text row = null;
    if (opts.files.isEmpty()) {
      new JCommander(opts).usage();
      return;
    }
    if (opts.row != null)
      row = new Text(opts.row);
    if (opts.extent != null) {
View Full Code Here

Examples of com.beust.jcommander.JCommander

public class AsciidoctorInvoker {

    public void invoke(String... parameters) {

        AsciidoctorCliOptions asciidoctorCliOptions = new AsciidoctorCliOptions();
        JCommander jCommander = new JCommander(asciidoctorCliOptions,
                parameters);

        if (asciidoctorCliOptions.isHelp() || parameters.length == 0) {
            jCommander.setProgramName("asciidoctor");
            jCommander.usage();
        } else {

            Asciidoctor asciidoctor = null;
           
            asciidoctor = buildAsciidoctorJInstance(asciidoctorCliOptions);
View Full Code Here

Examples of com.beust.jcommander.JCommander

        String parametersString = command.substring(command.indexOf(" "), command.length());
       
        String[] parameters = parametersString.split(" ");
       
        AsciidoctorCliOptions asciidoctorCliOptions = new AsciidoctorCliOptions();
        new JCommander(asciidoctorCliOptions,
                parameters);
       
        assertThat(asciidoctorCliOptions.getTemplateDir(), containsInAnyOrder(currentDirectory+"a", currentDirectory+"b"));
        assertThat(asciidoctorCliOptions.getSafeMode(), is(SafeMode.UNSAFE));
        assertThat(asciidoctorCliOptions.getBackend(), is("docbook"));
View Full Code Here

Examples of com.beust.jcommander.JCommander

        argumentsList.add(0, "start");
        arguments = argumentsList.toArray(new String[argumentsList.size()]);
      }
    }

    JCommander commander = new JCommander();
    ObfuscateOptions obfuscateOptions = new ObfuscateOptions();
    commander.addCommand("obfuscate", obfuscateOptions);

    StartOptions startOptions = new StartOptions();
    commander.addCommand("start", startOptions);

    StopOptions stopOptions = new StopOptions();
    commander.addCommand("stop", stopOptions);

    CheckConfigOptions checkConfigOptions = new CheckConfigOptions();
    commander.addCommand("checkConfig", checkConfigOptions);

    commander.parse(arguments);

    switch (commander.getParsedCommand()) {
    case "start":
      startTc(startOptions);
      break;
    case "stop":
      stopTc(stopOptions);
      break;
    case "obfuscate":
      ObfuscateUtil.obfuscate(obfuscateOptions);
      break;
    case "checkConfig":
      CheckConfig.check(checkConfigOptions);
      break;
    default:
      commander.usage();
      break;
    }

  }
View Full Code Here

Examples of com.beust.jcommander.JCommander

        }
    }

    private static ScrutineerCommandLineOptions parseOptions(String[] args) {
        ScrutineerCommandLineOptions options = new ScrutineerCommandLineOptions();
        new JCommander(options, args);
        return options;
    }
View Full Code Here

Examples of com.beust.jcommander.JCommander

    return coreAction.getClusterName();
  }

  public CommonArgs(String[] args) {
    this.args = args;
    commander = new JCommander(this);
  }
View Full Code Here

Examples of com.beust.jcommander.JCommander

  }

  public CommonArgs(Collection args) {
    List<String> argsAsStrings = SliderUtils.collectionToStringList(args);
    this.args = argsAsStrings.toArray(new String[argsAsStrings.size()]);
    commander = new JCommander(this);
  }
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.