Skip to content

Commit

Permalink
Merge pull request #202 from ChenKangg/master
Browse files Browse the repository at this point in the history
update location + help command
  • Loading branch information
ChenKangg committed Apr 8, 2024
2 parents 4a4c025 + 9eb038c commit cbbdbdc
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/main/java/seedu/omnitravel/parser/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,11 @@ public static void currencyExchangeCommand(String line) throws OmniException{
public static void locationCommand(String line, TravelActivityList list) throws OmniException {
String[] command = line.split(" ");
if (command.length >= 3 && CheckParameters.isNumeric(command[1])){
String index = command[1];
String[] locationSplit = line.split(index);
String location = locationSplit[1].trim();
int listNumber = Integer.parseInt(index);
int listNumber = Integer.parseInt(command[1]);
// Extract location starting from the third element onwards
String[] locationArray = Arrays.copyOfRange(command, 2, command.length);
// Join the location into a single string
String location = String.join(" ", locationArray);
list.locationActivity(listNumber, location);
} else if (command.length == 2) {
throw new OmniException("Please specify a location");
Expand Down
1 change: 1 addition & 0 deletions src/main/java/seedu/omnitravel/storage/FileSave.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public void saveActivityList(TravelActivityList list) throws IOException {
+ " / " + travelActivity.getDuration()
+ " / " + travelActivity.getTag()
+ " / " + travelActivity.getExpense()
+ " / " + travelActivity.getLocation()
+ System.lineSeparator());
}
fw.close();
Expand Down
53 changes: 51 additions & 2 deletions src/main/java/seedu/omnitravel/ui/Ui.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,75 @@ public static void helpCommand(){
printLine();
System.out.println("These are the available commands!");
System.out.println("");
System.out.println("1. list: List out the current list\n" +
System.out.println(
"1. list: List out the current list\n" +
"Format: `list`\n" +

"2. help: Get all commands for the chatbot\n" +
"Format: `help`\n" +

"3. bye: Exit the chatbot\n" +
"Format: `bye`\n" +

"4. add <travel activity> <date> <duration> <tag>\n" +
"Format: `add DESCRIPTION /date YYYY-MM-DD /duration DURATION [/tag TAG]`\n" +

"5. accommodation <travel activity> <date> <duration> <tag>\n" +
"Format: `accommodation DESCRIPTION /date YYYY-MM-DD /duration DURATION [/tag TAG]`\n" +

"6. food <travel activity> <date> <duration> <tag>\n" +
"Format: `food DESCRIPTION /date YYYY-MM-DD /duration DURATION [/tag TAG]`\n" +

"7. landmark <travel activity> <date> <duration> <tag>\n" +
"Format: `landmark DESCRIPTION /date YYYY-MM-DD /duration DURATION [/tag TAG]`\n" +

"8. delete <activity number>\n" +
"Format: `delete INDEX`\n" +

"9. find <keyword>\n" +
"Format: `find DESCRIPTION`\n" +

"10. check <activity number>\n" +
"Format: `check INDEX`\n" +

"11. uncheck <activity number>\n" +
"Format: `uncheck INDEX`\n" +

"12. tag <activity number> <tag name>\n" +
"Format: `tag INDEX TAGNAME`\n" +

"13. untag <activity number>\n" +
"Format: `untag INDEX`\n" +

"14. update <update> <date> <duration> <tag>\n" +
"Format: `update INDEX /date YYYY-MM-DD /duration DURATION [/tag TAG]`\n" +

"15. findtag <tag name>\n" +
"Format: `findtag TAG`\n" +

"16. findtype <type>\n" +
"Format: `findtype TYPE`\n" +

"17. expense <activity number> <expense amount>\n" +
"Format: `expense INDEX EXPENSE`\n" +

"18. removeexpense <activity number>\n" +
"Format: `removeexpense INDEX`\n" +

"19. totalexpense <type>\n" +
"20. change <amount> /from <current currency> /to <changed currency> ");
"Format: `totalexpense [/type TYPE]`\n" +

"20. change <amount> /from <current currency> /to <changed currency>\n" +
"Format: `change AMOUNT /from CODE /to CODE`\n" +

"21. location <activity number> <location>\n" +
"Format: `location INDEX LOCATION`\n" +

"22. removelocation <activity number>\n" +
"Format: `removelocation INDEX`\n" +

"23. findlocation <location>\n" +
"Format: `findlocation LOCATION`\n");
printLine();
}

Expand Down

0 comments on commit cbbdbdc

Please sign in to comment.