public CancelOptions(CommandLine line) { super(line); this.args = line.getArgs(); this.withSavepoint = line.hasOption(CANCEL_WITH_SAVEPOINT_OPTION.getOpt()); this.targetDirectory = line.getOptionValue(CANCEL_WITH_SAVEPOINT_OPTION.getOpt()); }
private void retainCompatibility(String[] cmdArgs) throws CliParseException { if (args.length > 2) { err.println("'delete path [version]' has been deprecated. " + "Please use 'delete [-v version] path' instead."); Parser parser = new PosixParser(); try { cl = parser.parse(options, cmdArgs); } catch (ParseException ex) { throw new CliParseException(ex); } args = cl.getArgs(); } }
@Override public StandaloneJobClusterConfiguration createResult(@Nonnull CommandLine commandLine) { final String configDir = commandLine.getOptionValue(CONFIG_DIR_OPTION.getOpt()); final Properties dynamicProperties = commandLine.getOptionProperties(DYNAMIC_PROPERTY_OPTION.getOpt()); final String restPortString = commandLine.getOptionValue(REST_PORT_OPTION.getOpt(), "-1"); final int restPort = Integer.parseInt(restPortString); final String hostname = commandLine.getOptionValue(HOST_OPTION.getOpt()); final String jobClassName = commandLine.getOptionValue(JOB_CLASS_NAME_OPTION.getOpt()); final SavepointRestoreSettings savepointRestoreSettings = CliFrontendParser.createSavepointRestoreSettings(commandLine); return new StandaloneJobClusterConfiguration( configDir, dynamicProperties, commandLine.getArgs(), hostname, restPort, jobClassName, savepointRestoreSettings); } }
@Override public void parse(String[] args) { super.parse(args); // support the old syntax "hivemetastore [port]" but complain args = commandLine.getArgs(); if (args.length > 0) { // complain about the deprecated syntax -- but still run System.err.println( "This usage has been deprecated, consider using the new command " + "line syntax (run with -h to see usage information)"); this.port = new Integer(args[0]); } // notice that command line options take precedence over the // deprecated (old style) naked args... if (commandLine.hasOption('p')) { this.port = Integer.parseInt(commandLine.getOptionValue('p')); } else { // legacy handling String metastorePort = System.getenv("METASTORE_PORT"); if (metastorePort != null) { this.port = Integer.parseInt(metastorePort); } } }
commandLine = parser.parse(options, args); args = commandLine.getArgs(); System.err.println(e.getMessage()); usage(options); String className = commandLine.getOptionValue("t", "com.atilika.kuromoji.ipadic.Tokenizer"); String userDictionaryFilename = commandLine.getOptionValue("u"); System.err.println("Could not create tokenizer. Got " + e); e.printStackTrace(); System.exit(1); String outputFilename = commandLine.getOptionValue("o");
@Override public CliCommand parse(String[] cmdArgs) throws CliParseException { Parser parser = new PosixParser(); try { cl = parser.parse(options, cmdArgs); } catch (ParseException ex) { throw new CliParseException(ex); } args = cl.getArgs(); if (cl.hasOption("?")) { printHelp(); } retainCompatibility(cmdArgs); return this; }
protected ProgramOptions(CommandLine line) throws CliArgsException { super(line); String[] args = line.hasOption(ARGS_OPTION.getOpt()) ? line.getOptionValues(ARGS_OPTION.getOpt()) : line.getArgs(); if (line.hasOption(JAR_OPTION.getOpt())) { this.jarFilePath = line.getOptionValue(JAR_OPTION.getOpt()); if (line.hasOption(CLASSPATH_OPTION.getOpt())) { for (String path : line.getOptionValues(CLASSPATH_OPTION.getOpt())) { try { this.entryPointClass = line.hasOption(CLASS_OPTION.getOpt()) ? line.getOptionValue(CLASS_OPTION.getOpt()) : null; if (line.hasOption(PARALLELISM_OPTION.getOpt())) { String parString = line.getOptionValue(PARALLELISM_OPTION.getOpt()); try { parallelism = Integer.parseInt(parString);
@Override public int run(CommandLine cl) throws AlluxioException, IOException { String[] args = cl.getArgs(); AlluxioURI path = new AlluxioURI(args[1]); Matcher matchUserGroup = USER_GROUP_PATTERN.matcher(args[0]); if (matchUserGroup.matches()) { mOwner = matchUserGroup.group("user"); mGroup = matchUserGroup.group("group"); runWildCardCmd(path, cl); return 0; } System.out.println("Failed to parse " + args[0] + " as user or user:group"); return -1; }
CommandLine cl = parser.parse(opt, args); if (args.length == 0 || cl.hasOption('h')) { HelpFormatter f = new HelpFormatter(); f.printHelp( return; String[] arg = cl.getArgs(); String modelFile; String input; String output = null; if (cl.hasOption("f") && arg.length == 3) { modelFile = arg[0]; input = arg[1]; if (cl.hasOption("f")) { String s = pos.tagFile(input); OutputStreamWriter w = new OutputStreamWriter(new FileOutputStream( } else { String s = pos.tag(input); System.out.println(s);
public SavepointOptions(CommandLine line) { super(line); args = line.getArgs(); dispose = line.hasOption(SAVEPOINT_DISPOSE_OPTION.getOpt()); disposeSavepointPath = line.getOptionValue(SAVEPOINT_DISPOSE_OPTION.getOpt()); jarFile = line.getOptionValue(JAR_OPTION.getOpt()); }
public static GalenActionDumpArguments parse(String[] args) { args = ArgumentsUtils.processSystemProperties(args); Options options = new Options(); options.addOption("u", "url", true, "Initial test url"); options.addOption("s", "size", true, "Browser window size"); options.addOption("W", "max-width", true, "Maximum width of element area image"); options.addOption("H", "max-height", true, "Maximum height of element area image"); options.addOption("E", "export", true, "Export path for page dump"); options.addOption("c", "config", true, "Path to config"); CommandLineParser parser = new PosixParser(); CommandLine cmd; try { cmd = parser.parse(options, args); } catch (MissingArgumentException e) { throw new IllegalArgumentException("Missing value for " + e.getOption().getLongOpt(), e); } catch (Exception ex) { throw new RuntimeException(ex); } GalenActionDumpArguments arguments = new GalenActionDumpArguments(); arguments.setUrl(cmd.getOptionValue("u")); arguments.setScreenSize(convertScreenSize(cmd.getOptionValue("s"))); arguments.setMaxWidth(parseOptionalInt(cmd.getOptionValue("W"))); arguments.setMaxHeight(parseOptionalInt(cmd.getOptionValue("H"))); arguments.setExport(cmd.getOptionValue("E")); arguments.setPaths(asList(cmd.getArgs())); arguments.setConfig(cmd.getOptionValue("c")); return arguments; }
@Override public int run(CommandLine cl) throws IOException { String[] args = cl.getArgs(); String dir; if (args.length < 1) { dir = null; } else { dir = args[0]; } boolean local = cl.hasOption(LOCAL_OPTION.getLongOpt()); BackupResponse resp = mMetaClient.backup(dir, local); if (local) { mPrintStream.printf("Successfully backed up journal to %s on master %s%n", resp.getBackupUri(), resp.getHostname()); } else { mPrintStream.printf("Successfully backed up journal to %s%n", resp.getBackupUri()); } return 0; }
private static void cmdBuild(CommandLine cli) throws BrutException { String[] args = cli.getArgs(); String appDirName = args.length < 2 ? "." : args[1]; File outFile; if (cli.hasOption("f") || cli.hasOption("force-all")) { apkOptions.forceBuildAll = true; if (cli.hasOption("d") || cli.hasOption("debug")) { System.out.println("SmaliDebugging has been removed in 2.1.0 onward. Please see: https://github.com/iBotPeaches/Apktool/issues/1061"); apkOptions.debugMode = true; if (cli.hasOption("a") || cli.hasOption("aapt")) { apkOptions.aaptPath = cli.getOptionValue("a"); if (cli.hasOption("c") || cli.hasOption("copy-original")) { if (cli.hasOption("p") || cli.hasOption("frame-path")) { apkOptions.frameworkFolderLocation = cli.getOptionValue("p"); if (cli.hasOption("nc") || cli.hasOption("no-crunch")) { if (cli.hasOption("o") || cli.hasOption("output")) { outFile = new File(cli.getOptionValue("o")); } else { outFile = null; System.err.println(ex.getMessage()); System.exit(1);
private void retainCompatibility(String[] cmdArgs) throws CliParseException { // stat path [watch] if (args.length > 2) { // rewrite to option cmdArgs[2] = "-w"; err.println("'stat path [watch]' has been deprecated. " + "Please use 'stat [-w] path' instead."); Parser parser = new PosixParser(); try { cl = parser.parse(options, cmdArgs); } catch (ParseException ex) { throw new CliParseException(ex); } args = cl.getArgs(); } }
CommandLine cl = parser.parse(opt, args); if (args.length == 0 || cl.hasOption('h')) { HelpFormatter f = new HelpFormatter(); f.printHelp( return; String[] arg = cl.getArgs(); String modelFile; String input; String output = null; if (cl.hasOption("f") && arg.length == 3) { modelFile = arg[0]; input = arg[1]; if (cl.hasOption("f")) { String s = seg.tagFile(input); OutputStreamWriter w = new OutputStreamWriter(new FileOutputStream( } else { String s = seg.tag(input); System.out.println(s);
@Override public int run(CommandLine cl) throws AlluxioException, IOException { String[] args = cl.getArgs(); AlluxioURI path = new AlluxioURI(args[0]); Integer replicationMax = cl.hasOption("max") ? Integer.valueOf(cl.getOptionValue("max")) : null; Integer replicationMin = cl.hasOption("min") ? Integer.valueOf(cl.getOptionValue("min")) : null; boolean recursive = cl.hasOption("R"); if (replicationMax == null && replicationMin == null) { throw new IOException("At least one option of '-max' or '-min' must be specified"); } if (replicationMax != null && replicationMin != null && replicationMax >= 0 && replicationMax < replicationMin) { throw new IOException("Invalid values for '-max' and '-min' options"); } setReplication(path, replicationMax, replicationMin, recursive); return 0; }
arguments.setTestngReport(cmd.getOptionValue("g")); arguments.setJunitReport(cmd.getOptionValue("x")); arguments.setHtmlReport(cmd.getOptionValue("h")); arguments.setJsonReport(cmd.getOptionValue("j")); arguments.setUrl(cmd.getOptionValue("u")); arguments.setIncludedTags(convertTags(cmd.getOptionValue("i"))); arguments.setExcludedTags(convertTags(cmd.getOptionValue("e"))); arguments.setPaths(asList(cmd.getArgs())); arguments.setConfig(cmd.getOptionValue("c")); arguments.setSectionNameFilter(cmd.getOptionValue("S"));
if (commandLine.hasOption("A")) System.out.println(commandLine.getOptionValue("A")); if (commandLine.hasOption("r")) System.out.println(commandLine.getOptionValue("r")); if (commandLine.hasOption("S")) System.out.println(commandLine.getOptionValue("S")); String[] remainder = commandLine.getArgs(); System.out.print("Remaining arguments: "); for (String argument : remainder)