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

Dieser Commit ist enthalten in:
wizjany 2013-08-03 09:23:36 -04:00
Ursprung 98e466d371
Commit cd5f832adf

Datei anzeigen

@ -204,6 +204,18 @@ public class CommandContext {
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) {
return booleanFlags.contains(ch) || valueFlags.containsKey(ch);
}