Permalink
Browse files

Merge pull request #50 from masonsbro/master

Updated BasicArgsParser to allow non-flag arguments to appear in places other than the end.
  • Loading branch information...
sk89q committed Jun 13, 2013
2 parents 479ef5e + 2c5e931 commit 5364a072e1a151dcb28a8f1eb2cb33b6a9f5d899
Showing with 2 additions and 7 deletions.
  1. +2 −7 src/main/java/com/sk89q/mclauncher/util/BasicArgsParser.java
@@ -42,16 +42,12 @@ public ArgsContext parse(String[] args) {
List<String> leftOver = new ArrayList<String>();
Set<String> flags = new HashSet<String>();
Map<String, String> values = new HashMap<String, String>();
-
- boolean processingFlags = true;
+
String wantingFlag = null;
-
+
for (int i = 0; i < args.length; i++) {
String arg = args[i];
if (arg.startsWith("-")) {
- if (!processingFlags) {
- throw new IllegalArgumentException("Flags must come first");
- }
if (arg.length() == 1) {
throw new IllegalArgumentException("Flag with no name");
}
@@ -67,7 +63,6 @@ public ArgsContext parse(String[] args) {
values.put(wantingFlag, arg);
wantingFlag = null;
} else {
- processingFlags = false;
leftOver.add(arg);
}
}

0 comments on commit 5364a07

Please sign in to comment.