Added methods to CommandContext to get slices excluding flags et al.

This commit is contained in:
wizjany 2013-08-03 09:23:36 -04:00
parent 98e466d371
commit cd5f832adf

View File

@ -204,6 +204,18 @@ public class CommandContext {
return slice; return slice;
} }
public String[] getParsedSlice(int index) {
String[] slice = new String[parsedArgs.size() - index];
System.arraycopy(parsedArgs.toArray(new String[parsedArgs.size()]), index, slice, 0, parsedArgs.size() - index);
return slice;
}
public String[] getParsedPaddedSlice(int index, int padding) {
String[] slice = new String[parsedArgs.size() - index + padding];
System.arraycopy(parsedArgs.toArray(new String[parsedArgs.size()]), index, slice, padding, parsedArgs.size() - index);
return slice;
}
public boolean hasFlag(char ch) { public boolean hasFlag(char ch) {
return booleanFlags.contains(ch) || valueFlags.containsKey(ch); return booleanFlags.contains(ch) || valueFlags.containsKey(ch);
} }