fix for cmd

This commit is contained in:
Jonathan Shook
2020-04-30 10:41:00 -05:00
parent a8ed90ae58
commit ff640c07a5

View File

@@ -24,7 +24,7 @@ public class Cmd {
run(),
await(Arg.of("alias_name")),
stop(Arg.of("alias_name")),
waitmillis(Arg.of("millis_to_wait", Long::parseLong));
waitMillis(Arg.of("millis_to_wait", Long::parseLong));
private final Arg<?>[] positional;
@@ -40,6 +40,15 @@ public class Cmd {
return names;
}
public static CmdType valueOfAnyCase(String cmdname) {
for (CmdType value : values()) {
if (cmdname.equals(value.toString()) || cmdname.toLowerCase().equals(value.toString().toLowerCase())) {
return value;
}
}
return valueOf(cmdname); // let the normal exception take over in this case
}
public Arg<?>[] getPositionalArgs() {
return positional;
}