![JAR search and dependency download from the Maven repository](/logo.png)
com.ociweb.pronghorn.util.MainArgs Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Pronghorn Show documentation
Show all versions of Pronghorn Show documentation
Primary dependency for any project using the Pronghorn framework
The newest version!
package com.ociweb.pronghorn.util;
public class MainArgs {
public static String getOptArg(String longName, String shortName, String[] args, String defaultValue) {
String prev = null;
for (String token : args) {
if (longName.equals(prev) || shortName.equals(prev)) {
if (token == null || token.trim().length() == 0 || token.startsWith("-")) {
return defaultValue;
}
return reportChoice(longName, shortName, token.trim());
}
prev = token;
}
return reportChoice(longName, shortName, defaultValue);
}
public static boolean hasArg(String longName, String shortName, String[] args) {
for(String token : args) {
if(longName.equals(token) || shortName.equals(token)) {
reportChoice(longName, shortName, "");
return true;
}
}
return false;
}
static String reportChoice(final String longName, final String shortName, final String value) {
System.out.append(longName).append(" ").append(shortName).append(" ").append(value).append("\n");
return value;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy