fixed some issues
This commit is contained in:
parent
cc15618dca
commit
6f01a1287b
|
@ -55,7 +55,7 @@ public class CmdOptions {
|
||||||
|
|
||||||
public Option addCommand(String cmd) {
|
public Option addCommand(String cmd) {
|
||||||
if (cmd.contains(optionChar)) {
|
if (cmd.contains(optionChar)) {
|
||||||
cmd = cmd.replaceAll(optionChar, "");
|
cmd = cmd.replace(optionChar, "");
|
||||||
}
|
}
|
||||||
if (cmd.length() > 1) {
|
if (cmd.length() > 1) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
|
@ -67,7 +67,7 @@ public class CmdOptions {
|
||||||
|
|
||||||
public Option addLongCommand(String cmd) {
|
public Option addLongCommand(String cmd) {
|
||||||
if (cmd.contains(optionChar))
|
if (cmd.contains(optionChar))
|
||||||
cmd.replaceAll(optionChar, "");
|
cmd = cmd.replace(optionChar, "");
|
||||||
this.cmdLong.add(cmd);
|
this.cmdLong.add(cmd);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ public class CmdOptions {
|
||||||
ret += optionChar + s + ", ";
|
ret += optionChar + s + ", ";
|
||||||
}
|
}
|
||||||
for (String s : cmdLong) {
|
for (String s : cmdLong) {
|
||||||
ret += optionChar + s + ", ";
|
ret += optionChar + optionChar + s + ", ";
|
||||||
}
|
}
|
||||||
ret += ")";
|
ret += ")";
|
||||||
if (defaultParameter.size() > 0) {
|
if (defaultParameter.size() > 0) {
|
||||||
|
@ -194,7 +194,7 @@ public class CmdOptions {
|
||||||
this.createOption("help")
|
this.createOption("help")
|
||||||
.setDescription(
|
.setDescription(
|
||||||
"Show all possible options and their parameters.")
|
"Show all possible options and their parameters.")
|
||||||
.addCommand("--help").addCommand("-h").addCommand("-?");
|
.addLongCommand("--help").addCommand("-h").addCommand("-?");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CmdOptions i() {
|
public static CmdOptions i() {
|
||||||
|
@ -370,7 +370,7 @@ public class CmdOptions {
|
||||||
// check for correct options
|
// check for correct options
|
||||||
boolean ok = true;
|
boolean ok = true;
|
||||||
for (Integer i : indices) {
|
for (Integer i : indices) {
|
||||||
String o = args[i].replaceAll(optionChar, "");
|
String o = args[i].replace(optionChar, "");
|
||||||
if (!optionExists(o)) {
|
if (!optionExists(o)) {
|
||||||
if (this.combineSwitches) {
|
if (this.combineSwitches) {
|
||||||
for (char c : o.toCharArray()) {
|
for (char c : o.toCharArray()) {
|
||||||
|
@ -392,7 +392,7 @@ public class CmdOptions {
|
||||||
}
|
}
|
||||||
// now parse
|
// now parse
|
||||||
for (int a = 0; a < indices.length; ++a) {
|
for (int a = 0; a < indices.length; ++a) {
|
||||||
String o = args[indices[a]].replaceAll(optionChar, "");
|
String o = args[indices[a]].replace(optionChar, "");
|
||||||
// the option is set!
|
// the option is set!
|
||||||
this.getBareOption(o).setSet(true);
|
this.getBareOption(o).setSet(true);
|
||||||
// are there parameters?
|
// are there parameters?
|
||||||
|
|
Loading…
Reference in New Issue