diff --git a/docs/UserGuide.md b/docs/UserGuide.md index 8522cc9b822..42be7e467bc 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -16,7 +16,7 @@ GourmetGrid User Guide - Listing all contacts : list - Editing a contact : edit - Adding contacts as favourites : addfav - - Showing favourite contacts : showfav + - Showing favourite contacts : listfav - Removing contacts from favourites : removefav - Searching contact : find - Adding an order : addorder @@ -155,8 +155,9 @@ Examples: Shows a list of all contacts in the address book. Format: `list` + -**Note:** `list` command is not compatible with further arguments. +**Reminder:** `list` command is not compatible with further arguments. ### Editing a contact : `edit` @@ -170,6 +171,7 @@ Format: `edit INDEX [n/NAME] [p/PHONE] [e/EMAIL] [a/ADDRESS] [c/COMPANY] [t/TAG] * Existing values will be updated to the input values. * You can remove all the contact’s tags by typing `t/` without specifying any tags after it. +* **Warning**: Making any edit to tags will replace all existing tags with the new tags. Examples: * `edit 1 p/91234567 e/johndoe@example.com` Edits the phone number and email address of the 1st contact to be `91234567` and `johndoe@example.com` respectively. @@ -177,7 +179,7 @@ Examples: ### Adding contacts as favourites : `addfav` -- Adds the contacts specified by index as favourites +Adds the contacts specified by index as favourites Format: `addfav i/INDICES` - Adds the contacts at the specified `INDICES` as favourites. The indices refer to comma-separated index numbers (i.e. index, index, index) shown in the displayed contact list. Each index **must be a positive integer** 1,2,3, ... @@ -193,19 +195,21 @@ Examples: - `addfav` returns an error message as it must be accompanied by the 'INDICES' field - `addfav 1 i/ 2, 5` returns an error message as there should not be prefixes before the 'INDICES' field - -### Showing favourite contacts : `showfav` +### Showing favourite contacts : `listfav` + +Lists the contacts that are marked as favourites -- Shows the contacts that are marked as favourites +Format: `listfav` -Format: `showfav` + -**Note:** `showfav` command is not compatible with further arguments. +**Reminder:** `listfav` command is not compatible with further arguments. Examples: -- `showfav` Shows all favourited contacts as expected -- `showfav 1` returns an error message as there should not be arguments after the `showfav` command word -- `showfav hello` returns an error message as there should not be arguments after the `showfav` command word +- `listfav` Lists all favourited contacts as expected +- `listfav 1` returns an error message as there should not be arguments after the `listfav` command word +- `listfav hello` returns an error message as there should not be arguments after the `listfav` command word ### Removing contacts from favourites : `removefav` @@ -226,11 +230,9 @@ Examples: ### Searching Contact : `find` -- Search feature supports substring search by name and/or tags and/or company **ONLY**. -- Finds all contacts whose names, tags or company matches the substring keyword provided. - +Search feature supports substring search by name and/or tags and/or company **ONLY**. Finds all contacts whose names, tags or company matches the substring keyword provided. -General Format: `find FIELD/ KEYWORD FIELD/ KEYWORD ...` +Format: `find FIELD/KEYWORD [FIELD/KEYWORD]...` - Where `FIELD` is either `n/` for name or `t/` for tag or `c/` for company. - `KEYWORD` is the keyword to search for, here are some guidelines: - Name and Company should contain alphanumeric characters, spaces, hyphens and/or apostrophes only. @@ -353,12 +355,22 @@ Clears all entries from the address book. Format: `clear` + + +**Reminder:** `clear` command is not compatible with further arguments. + + ### Exiting the program : `exit` Exits the program. Format: `exit` + + +**Reminder:** `exit` command is not compatible with further arguments. + + ### Viewing help : `help` Shows a message explaining how to access the help page. @@ -367,6 +379,11 @@ Shows a message explaining how to access the help page. Format: `help` + + +**Reminder:** `help` command is not compatible with further arguments. + + ### Saving the data GourmetGrid data are saved in the hard disk automatically after any command that changes the data. There is no need to save manually. @@ -401,20 +418,20 @@ Furthermore, certain edits can cause GourmetGrid to behave in unexpected ways (e ## Command summary -| Action | Format, Examples | -|----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Action | Format, Examples | +|----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | **Add** | `add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS c/COMPANY [t/TAG]…​`
e.g., `add n/James Ho p/22224444 e/jamesho@example.com a/123, Clementi Rd, 1234665 c/Freshest Farm t/friend t/colleague` | -| **Clear** | `clear` | -| **Delete** | `delete INDEX`
e.g., `delete 3` | -| **Edit** | `edit INDEX [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [a/ADDRESS] [c/COMPANY] [t/TAG]…​`
e.g.,`edit 2 n/James Lee e/jameslee@example.com` | -| **Find** | `find KEYWORD/ [KEYWORD]`
e.g., `find n/ James n/ T t/ friend t/ rich` | -| **Add Order** | `addorder INDEX d/DATE r/REMARK`
e.g., `addorder 1 d/ 2020-01-01 r/ 100 chicken wings` | -| **List Orders** | `listorder INDEX` | -| **Delete Order** | `deleteorder INDEX o/ORDER_INDEX`
e.g., `deleteorder 2 o/1` | -| **Add Favourite** | `addfav i/INDICES`
e.g., `addfav i/1,2` | -| **Show Favourites** | `showfav` | -| **Remove Favourite** | `removefav i/INDICES`
e.g., `removefav i/2` | -| **List** | `list` | -| **Help** | `help` | -| **Exit** | `exit` | +| **Clear** | `clear` | +| **Delete** | `delete INDEX`
e.g., `delete 3` | +| **Edit** | `edit INDEX [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [a/ADDRESS] [c/COMPANY] [t/TAG]…​`
e.g.,`edit 2 n/James Lee e/jameslee@example.com` | +| **Find** | `find KEYWORD/ [KEYWORD]`
e.g., `find n/ James n/ T t/ friend t/ rich` | +| **Add Order** | `addorder INDEX d/DATE r/REMARK`
e.g., `addorder 1 d/ 2020-01-01 r/ 100 chicken wings` | +| **List Orders** | `listorder INDEX` | +| **Delete Order** | `deleteorder INDEX o/ORDER_INDEX`
e.g., `deleteorder 2 o/1` | +| **Add Favourite** | `addfav i/INDICES`
e.g., `addfav i/1,2` | +| **Show Favourites** | `listfav` | +| **Remove Favourite** | `removefav i/INDICES`
e.g., `removefav i/2` | +| **List** | `list` | +| **Help** | `help` | +| **Exit** | `exit` | diff --git a/docs/diagrams/ShowFavouriteSequenceDiagram.puml b/docs/diagrams/ShowFavouriteSequenceDiagram.puml index 868c834fe96..33a41bd6dd2 100644 --- a/docs/diagrams/ShowFavouriteSequenceDiagram.puml +++ b/docs/diagrams/ShowFavouriteSequenceDiagram.puml @@ -5,8 +5,8 @@ skinparam ArrowFontStyle plain box Logic LOGIC_COLOR_T1 participant ":LogicManager" as LogicManager LOGIC_COLOR participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR -participant ":ShowFavouriteCommandParser" as ShowFavouriteCommandParser LOGIC_COLOR -participant "s:ShowFavouriteCommand" as ShowFavouriteCommand LOGIC_COLOR +participant ":ListFavouriteCommandParser" as ListFavouriteCommandParser LOGIC_COLOR +participant "l:ListFavouriteCommand" as ListFavouriteCommand LOGIC_COLOR participant "r:CommandResult" as CommandResult LOGIC_COLOR end box @@ -25,36 +25,36 @@ activate LogicManager LogicManager -> AddressBookParser : parseCommand(args) activate AddressBookParser -create ShowFavouriteCommandParser -AddressBookParser -> ShowFavouriteCommandParser -activate ShowFavouriteCommandParser +create ListFavouriteCommandParser +AddressBookParser -> ListFavouriteCommandParser +activate ListFavouriteCommandParser -ShowFavouriteCommandParser --> AddressBookParser -deactivate ShowFavouriteCommandParser +ListFavouriteCommandParser --> AddressBookParser +deactivate ListFavouriteCommandParser -AddressBookParser -> ShowFavouriteCommandParser : parse(args) -activate ShowFavouriteCommandParser +AddressBookParser -> ListFavouriteCommandParser : parse(args) +activate ListFavouriteCommandParser -create ShowFavouriteCommand -ShowFavouriteCommandParser -> ShowFavouriteCommand -activate ShowFavouriteCommand +create ListFavouriteCommand +ListFavouriteCommandParser -> ListFavouriteCommand +activate ListFavouriteCommand -ShowFavouriteCommand --> ShowFavouriteCommandParser : -deactivate ShowFavouriteCommand +ListFavouriteCommand --> ListFavouriteCommandParser : +deactivate ListFavouriteCommand -ShowFavouriteCommandParser --> AddressBookParser : s -deactivate ShowFavouriteCommandParser +ListFavouriteCommandParser --> AddressBookParser : l +deactivate ListFavouriteCommandParser 'Hidden arrow to position the destroy marker below the end of the activation bar. -ShowFavouriteCommandParser -[hidden]-> AddressBookParser -destroy ShowFavouriteCommandParser +ListFavouriteCommandParser -[hidden]-> AddressBookParser +destroy ListFavouriteCommandParser -AddressBookParser --> LogicManager : s +AddressBookParser --> LogicManager : l deactivate AddressBookParser -LogicManager -> ShowFavouriteCommand : execute(m) -activate ShowFavouriteCommand +LogicManager -> ListFavouriteCommand : execute(m) +activate ListFavouriteCommand -ShowFavouriteCommand -> Model : updateFilteredPersonList(pred) +ListFavouriteCommand -> Model : updateFilteredPersonList(pred) activate Model Model -> FilteredList : setPredicate(pred) @@ -63,16 +63,16 @@ activate FilteredList FilteredList --> Model deactivate FilteredList -Model --> ShowFavouriteCommand +Model --> ListFavouriteCommand deactivate Model -ShowFavouriteCommand -> CommandResult +ListFavouriteCommand -> CommandResult activate CommandResult -CommandResult --> ShowFavouriteCommand +CommandResult --> ListFavouriteCommand deactivate CommandResult -ShowFavouriteCommand --> LogicManager : r -deactivate ShowFavouriteCommand +ListFavouriteCommand --> LogicManager : r +deactivate ListFavouriteCommand [<-- LogicManager : r deactivate LogicManager diff --git a/src/main/java/seedu/address/logic/commands/ShowFavouriteCommand.java b/src/main/java/seedu/address/logic/commands/ListFavouriteCommand.java similarity index 81% rename from src/main/java/seedu/address/logic/commands/ShowFavouriteCommand.java rename to src/main/java/seedu/address/logic/commands/ListFavouriteCommand.java index e5b10ca3616..4cc9feb15ce 100644 --- a/src/main/java/seedu/address/logic/commands/ShowFavouriteCommand.java +++ b/src/main/java/seedu/address/logic/commands/ListFavouriteCommand.java @@ -8,9 +8,9 @@ /** * Lists all favourites in the address book to the user. */ -public class ShowFavouriteCommand extends Command { +public class ListFavouriteCommand extends Command { - public static final String COMMAND_WORD = "showfav"; + public static final String COMMAND_WORD = "listfav"; public static final String MESSAGE_SUCCESS = "Displayed all favourites"; @@ -30,6 +30,6 @@ public boolean equals(Object other) { } // instanceof handles nulls - return other instanceof ShowFavouriteCommand; + return other instanceof ListFavouriteCommand; } } diff --git a/src/main/java/seedu/address/logic/parser/AddressBookParser.java b/src/main/java/seedu/address/logic/parser/AddressBookParser.java index e068174db5d..3d95c3f6e45 100644 --- a/src/main/java/seedu/address/logic/parser/AddressBookParser.java +++ b/src/main/java/seedu/address/logic/parser/AddressBookParser.java @@ -20,9 +20,9 @@ import seedu.address.logic.commands.FindCommand; import seedu.address.logic.commands.HelpCommand; import seedu.address.logic.commands.ListCommand; +import seedu.address.logic.commands.ListFavouriteCommand; import seedu.address.logic.commands.ListOrderCommand; import seedu.address.logic.commands.RemoveFavouriteCommand; -import seedu.address.logic.commands.ShowFavouriteCommand; import seedu.address.logic.parser.exceptions.ParseException; /** @@ -98,8 +98,8 @@ public Command parseCommand(String userInput) throws ParseException { case HelpCommand.COMMAND_WORD: return new HelpCommandParser().parse(arguments); - case ShowFavouriteCommand.COMMAND_WORD: - return new ShowFavouriteCommandParser().parse(arguments); + case ListFavouriteCommand.COMMAND_WORD: + return new ListFavouriteCommandParser().parse(arguments); default: logger.finer("This user input caused a ParseException: " + userInput); diff --git a/src/main/java/seedu/address/logic/parser/ShowFavouriteCommandParser.java b/src/main/java/seedu/address/logic/parser/ListFavouriteCommandParser.java similarity index 71% rename from src/main/java/seedu/address/logic/parser/ShowFavouriteCommandParser.java rename to src/main/java/seedu/address/logic/parser/ListFavouriteCommandParser.java index fe0864c0892..ca04847b562 100644 --- a/src/main/java/seedu/address/logic/parser/ShowFavouriteCommandParser.java +++ b/src/main/java/seedu/address/logic/parser/ListFavouriteCommandParser.java @@ -2,22 +2,22 @@ import static seedu.address.logic.parser.ParserUtil.parseNoArgs; -import seedu.address.logic.commands.ShowFavouriteCommand; +import seedu.address.logic.commands.ListFavouriteCommand; import seedu.address.logic.parser.exceptions.ParseException; /** * Parses input arguments and creates a new ShowFavouriteCommand object */ -public class ShowFavouriteCommandParser implements Parser { +public class ListFavouriteCommandParser implements Parser { /** * Parses any potential {@code String} of text in the context of the ShowFavouriteCommand that should not be there, * and returns an AddCommand object for execution. * @throws ParseException if the user input has any text after the command word */ - public ShowFavouriteCommand parse(String args) throws ParseException { + public ListFavouriteCommand parse(String args) throws ParseException { parseNoArgs(args); - return new ShowFavouriteCommand(); + return new ListFavouriteCommand(); } } diff --git a/src/test/java/seedu/address/logic/commands/ShowFavouriteCommandTest.java b/src/test/java/seedu/address/logic/commands/ListFavouriteCommandTest.java similarity index 68% rename from src/test/java/seedu/address/logic/commands/ShowFavouriteCommandTest.java rename to src/test/java/seedu/address/logic/commands/ListFavouriteCommandTest.java index ddc783e6d72..042599a1f3e 100644 --- a/src/test/java/seedu/address/logic/commands/ShowFavouriteCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/ListFavouriteCommandTest.java @@ -16,38 +16,38 @@ /** * Contains integration tests (interaction with the Model) and unit tests for ShowFavouriteCommand. */ -public class ShowFavouriteCommandTest { +public class ListFavouriteCommandTest { @Test - public void execute_showFavouriteWithFavourites_success() { + public void execute_listFavouriteWithFavourites_success() { Model model = new ModelManager(getTypicalAddressBook(), new UserPrefs()); - ShowFavouriteCommand showFavouriteCommand = new ShowFavouriteCommand(); + ListFavouriteCommand listFavouriteCommand = new ListFavouriteCommand(); - String expectedMessage = ShowFavouriteCommand.MESSAGE_SUCCESS; + String expectedMessage = ListFavouriteCommand.MESSAGE_SUCCESS; Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()), new UserPrefs()); model.setPerson(ALICE, new PersonBuilder(ALICE).withFavourite(true).build()); expectedModel.updateFilteredPersonList(person -> person.isSamePerson(ALICE)); // only Alice is favourited model.updateFilteredPersonList(Model.PREDICATE_SHOW_FAVOURITES); - assertCommandSuccess(showFavouriteCommand, model, expectedMessage, expectedModel); + assertCommandSuccess(listFavouriteCommand, model, expectedMessage, expectedModel); } @Test public void equals() { - ShowFavouriteCommand showFavouriteCommand = new ShowFavouriteCommand(); + ListFavouriteCommand listFavouriteCommand = new ListFavouriteCommand(); // same object -> returns true - assert (showFavouriteCommand.equals(showFavouriteCommand)); + assert (listFavouriteCommand.equals(listFavouriteCommand)); // same values -> returns true - ShowFavouriteCommand showFavouriteCommandCopy = new ShowFavouriteCommand(); - assert (showFavouriteCommand.equals(showFavouriteCommandCopy)); + ListFavouriteCommand listFavouriteCommandCopy = new ListFavouriteCommand(); + assert (listFavouriteCommand.equals(listFavouriteCommandCopy)); // different types -> returns false - assertFalse(showFavouriteCommand.equals(1)); + assertFalse(listFavouriteCommand.equals(1)); // null -> returns false - assertFalse(showFavouriteCommand.equals(null)); + assertFalse(listFavouriteCommand.equals(null)); } } diff --git a/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java b/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java index 98c9787f4ad..41b7898f260 100644 --- a/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java +++ b/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java @@ -28,9 +28,9 @@ import seedu.address.logic.commands.FindCommand; import seedu.address.logic.commands.HelpCommand; import seedu.address.logic.commands.ListCommand; +import seedu.address.logic.commands.ListFavouriteCommand; import seedu.address.logic.commands.ListOrderCommand; import seedu.address.logic.commands.RemoveFavouriteCommand; -import seedu.address.logic.commands.ShowFavouriteCommand; import seedu.address.logic.parser.exceptions.ParseException; import seedu.address.model.order.Date; import seedu.address.model.order.Order; @@ -148,11 +148,11 @@ public void parseCommand_listOrder() throws Exception { } @Test - public void parseCommand_showFavourite() throws Exception { - assertTrue(parser.parseCommand(ShowFavouriteCommand.COMMAND_WORD) instanceof ShowFavouriteCommand); - assertTrue(parser.parseCommand(ShowFavouriteCommand.COMMAND_WORD + " ") instanceof ShowFavouriteCommand); + public void parseCommand_listFavourite() throws Exception { + assertTrue(parser.parseCommand(ListFavouriteCommand.COMMAND_WORD) instanceof ListFavouriteCommand); + assertTrue(parser.parseCommand(ListFavouriteCommand.COMMAND_WORD + " ") instanceof ListFavouriteCommand); assertThrows(ParseException.class, MESSAGE_INVALID_NO_ARGUMENTS_COMMAND, () -> parser.parseCommand( - ShowFavouriteCommand.COMMAND_WORD + " 3")); + ListFavouriteCommand.COMMAND_WORD + " 3")); } @Test