diff --git a/src/java/boa/BoaMain.java b/src/java/boa/BoaMain.java index 8fcb129c7..c94e7100b 100644 --- a/src/java/boa/BoaMain.java +++ b/src/java/boa/BoaMain.java @@ -24,7 +24,7 @@ import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.Options; -import org.apache.commons.cli.DefaultParser; +import org.apache.commons.cli.PosixParser; /** * The main entry point for Boa-related tools. @@ -46,7 +46,7 @@ public static void main(final String[] args) throws IOException { printHelp(options, null); return; } else { - final CommandLine cl = new DefaultParser().parse(options, new String[] { args[0] }); + final CommandLine cl = new PosixParser().parse(options, new String[] { args[0] }); final String[] tempargs = new String[args.length - 1]; System.arraycopy(args, 1, tempargs, 0, args.length - 1); diff --git a/src/java/boa/compiler/BoaCompiler.java b/src/java/boa/compiler/BoaCompiler.java index 148f0a4f4..2a4f17f06 100644 --- a/src/java/boa/compiler/BoaCompiler.java +++ b/src/java/boa/compiler/BoaCompiler.java @@ -39,9 +39,9 @@ import org.stringtemplate.v4.ST; import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.DefaultParser; import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.Options; +import org.apache.commons.cli.PosixParser; import org.apache.log4j.Logger; import org.scannotation.ClasspathUrlFinder; @@ -383,7 +383,7 @@ private static CommandLine processCommandLineOptions(final String[] args) { final CommandLine cl; try { - cl = new DefaultParser().parse(options, args); + cl = new PosixParser().parse(options, args); } catch (final org.apache.commons.cli.ParseException e) { System.err.println(e.getMessage()); new HelpFormatter().printHelp("Boa Compiler", options); @@ -422,7 +422,7 @@ private static CommandLine processParseCommandLineOptions(final String[] args) { final CommandLine cl; try { - cl = new DefaultParser().parse(options, args); + cl = new PosixParser().parse(options, args); } catch (final org.apache.commons.cli.ParseException e) { printHelp(options, e.getMessage()); return null; diff --git a/src/java/boa/datagen/BoaGenerator.java b/src/java/boa/datagen/BoaGenerator.java index 8eea84c44..384bccdac 100644 --- a/src/java/boa/datagen/BoaGenerator.java +++ b/src/java/boa/datagen/BoaGenerator.java @@ -20,9 +20,9 @@ import java.io.IOException; import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.DefaultParser; import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.Options; +import org.apache.commons.cli.PosixParser; import boa.datagen.forges.github.GetGithubRepoByUser; import boa.datagen.forges.github.LocalGitSequenceGenerator; @@ -43,7 +43,7 @@ public static void main(final String[] args) throws IOException { final CommandLine cl; try { - cl = new DefaultParser().parse(options, args); + cl = new PosixParser().parse(options, args); } catch (final org.apache.commons.cli.ParseException e) { System.err.println(e.getMessage()); new HelpFormatter().printHelp("BoaCompiler", options); diff --git a/src/java/boa/evaluator/BoaEvaluator.java b/src/java/boa/evaluator/BoaEvaluator.java index 8a3a0f170..f9abda450 100644 --- a/src/java/boa/evaluator/BoaEvaluator.java +++ b/src/java/boa/evaluator/BoaEvaluator.java @@ -25,8 +25,9 @@ import java.util.UUID; import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.DefaultParser; +import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.Options; +import org.apache.commons.cli.PosixParser; import org.apache.commons.io.FileUtils; import boa.BoaMain; @@ -74,7 +75,7 @@ public static void main(final String[] args) { printHelp(options, null); return; } else { - final CommandLine cl = new DefaultParser().parse(options, args); + final CommandLine cl = new PosixParser().parse(options, args); if (cl.hasOption('i') && cl.hasOption('d')) { final BoaEvaluator evaluator; diff --git a/src/java/boa/runtime/BoaRunner.java b/src/java/boa/runtime/BoaRunner.java index ee2435598..37714cf3e 100644 --- a/src/java/boa/runtime/BoaRunner.java +++ b/src/java/boa/runtime/BoaRunner.java @@ -1,7 +1,6 @@ /* - * Copyright 2017, Anthony Urso, Hridesh Rajan, Robert Dyer, - * Iowa State University of Science and Technology - * and Bowling Green State University + * Copyright 2014, Anthony Urso, Hridesh Rajan, Robert Dyer, + * and Iowa State University of Science and Technology * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,11 +19,11 @@ import java.io.IOException; import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.DefaultParser; import org.apache.commons.cli.HelpFormatter; -import org.apache.commons.cli.Option; +import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; +import org.apache.commons.cli.PosixParser; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; @@ -106,21 +105,21 @@ public Job job(final Path[] ins, final Path out) throws IOException { static { options.addOption("p", "profile", false, "if true, profiles the execution of 1 map task"); options.addOption("b", "block", false, "if true, wait for job to finish and show status"); - options.addOption(Option.builder("j").longOpt("job") - .desc("sets the MySql ID to update with this job's status") + options.addOption(OptionBuilder.withLongOpt("job") + .withDescription("sets the MySql ID to update with this job's status") .hasArg() - .argName("ID") - .build()); - options.addOption(Option.builder("a").longOpt("ast") - .desc("which INPUT to use for ASTs") + .withArgName("ID") + .create("j")); + options.addOption(org.apache.commons.cli.OptionBuilder.withLongOpt("ast") + .withDescription("which INPUT to use for ASTs") .hasArg() - .argName("INPUT") - .build()); - options.addOption(Option.builder("c").longOpt("comments") - .desc("which INPUT to use for comments") + .withArgName("INPUT") + .create("a")); + options.addOption(org.apache.commons.cli.OptionBuilder.withLongOpt("comments") + .withDescription("which INPUT to use for comments") .hasArg() - .argName("INPUT") - .build()); + .withArgName("INPUT") + .create("c")); } protected static Options getOptions() { return options; } @@ -129,7 +128,7 @@ public static CommandLine parseArgs(String[] args, String usage) { CommandLine line = null; try { - line = new DefaultParser().parse(options, args); + line = new PosixParser().parse(options, args); } catch (ParseException exp) { System.err.println(exp.getMessage()); printHelp(usage);