Skip to content

Commit

Permalink
Parser: Reduce getCommandType method
Browse files Browse the repository at this point in the history
Follow code quality
  • Loading branch information
WinstonJin committed Sep 18, 2024
1 parent c173269 commit 75260e4
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions src/main/java/windebot/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,8 @@ public static Command parse(String input) throws UnsupportedCommandException {
private static SubCommandType getCommandType(String input) {
if (input.startsWith("todo")) {
return SubCommandType.TODO;
} else if (input.startsWith("T")) {
return SubCommandType.TODO;
} else if (input.startsWith("deadline")) {
return SubCommandType.DEADLINE;
} else if (input.startsWith("D")) {
return SubCommandType.DEADLINE;
} else if (input.startsWith("E")) {
return SubCommandType.EVENT;
} else if (input.startsWith("event")) {
return SubCommandType.EVENT;
} else if (input.equals("list")) {
Expand All @@ -116,15 +110,9 @@ private static SubCommandType getCommandType(String input) {
return SubCommandType.DATE;
} else if (input.startsWith("find")) {
return SubCommandType.FIND;
} else if (input.startsWith("change")) {
return SubCommandType.CHANGE;
} else if (input.startsWith("cutoff")) {
return SubCommandType.CHANGE;
} else if (input.startsWith("start")) {
return SubCommandType.CHANGE;
} else if (input.startsWith("end")) {
return SubCommandType.CHANGE;
} else if (input.startsWith("action")) {
} else if (input.startsWith("change") || input.startsWith("cutoff")
|| input.startsWith("start") || input.startsWith("end")
|| input.startsWith("action")) {
return SubCommandType.CHANGE;
} else {
return SubCommandType.UNKNOWN;
Expand Down

0 comments on commit 75260e4

Please sign in to comment.