Skip to content

Commit

Permalink
Merge branch 'master' into v1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
SHni99 committed Mar 25, 2023
2 parents 549ebd7 + bd75a10 commit 342d5f2
Show file tree
Hide file tree
Showing 23 changed files with 409 additions and 211 deletions.
170 changes: 111 additions & 59 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,131 @@
# User Guide

* Quick Start
* Features
* Viewing help: `help`
* Adding a person: `add`
* Deleting a person: `delete`
* Listing all contacts: `list`
* Locating persons by keywords: `find`
* Add an image for contacts: `add-image`
* Delete an image for contacts: `delete-image`
* Quick import admin contacts: `import`
* FAQ
* Command summary

---

## Quick start

1. Ensure you have Java `11` or above installed in your computer.
2. Download the latest `bookface.jar` from [here](https://github.com/AY2223S2-CS2103-F11-4/tp/releases).
3. Place `bookface.jar` file in the folder you would like to use as the *home directory*.
4. Run the application. The following GUI will appear upon first use of the application.
![GUI upon first use](images/GUIOnInitialUsage.png)

5. The application is initially loaded with sample data for new users to try out the [features](#Features) listed below.
Experienced users can delete the sample data and proceed with regular usage.

---

## Features

### Help command: `help`

Shows a link to the user guide to help new users get familiar with the commands for the application.

Format: `help`

### Add user contacts: `add`

Format: `add [name] [year/course] [phone number] [email] [address]` Optional to add: `t/TAGS`

* User is *required* to enter **name, status, phone number, email, address**
* Tags can be optional
* If the account exists, user can add in related field of interests to share with others

Example:
* `add n/Shenghan s/Year2 Computer-science p/99999999 e/[email protected] a/punngol place 696a #12-348` will displays the
necessary basic information that are the user's name, year/course, phone number, email, address. Optional fields are tags,
for which there are commitment/cca tags, module tags and lastly the general tags for users to enter non-specific typed tags.

Example (with the addition of tags):
* `add n/Shenghan s/Year2 Computer-science p/99999999 e/[email protected] a/punngol place 696a #12-348 t/developer ct/soccer
mt/cs2103` Note that the tags can be placed in any part of the command, and it will not break!

Tags are categorised according to tag colors:
* Commitment tags: `coral pink`
* Module tags: `Dark green`
* General tags: `default blue`

### Delete user contacts: `delete`

Delete a contact.
Format: `delete INDEX`

* Show contact details specified by `INDEX`
* The index refers to the index number shown in the displayed person list.
* The index *must* be a positive integer 1, 2, 3, …
* Extra: Will prompt user to re-confirm again before the contact is erased from BookFace
Example:
* `delete 2` Brings up the 2nd person in the address book and prompt user to confirm before deleting.

### Listing all contacts: `list`

List all contacts in the address book.

Format: `list`

### Locating persons by name/class/group: `find`
### Locating persons by keywords: `find`

Finds persons whose contact details contain any of the given keywords based on the
prefix specified.

Finds persons whose names contain any of the given keywords.
Format: `find KEYWORD [MORE_KEYWORDS]`
Format: `find [PREFIX]/KEYWORD [MORE [PREFIX]/KEYWORD]...`

* The search is case-insensitive e.g. `hans` will match `Hans`
* The order of the keywords does not matter e.g. `Hans Bo` will match `Bo Hans`
* Only the name is searched
* Only full words will be matched e.g. `Han` will not match `Hans`
* Persons matching at least one keyword will be returned (i.e. `OR` search) e.g. `Hans Bo` will return `Hans Gruber`
, `Bo Yang`
* The search will filter by the `PREFIX` provided, e.g. `n/` searches through the
names of the contacts, `p/` searches through the phone number of the contacts, `t/`
searches through the tags of the contact, etc...
* Each prefix must be followed by one and only one keyword. See below for example usage.
* The search is done via the logical ***AND*** operator, i.e. `find n/john t/cs` will return
the list of contacts where his name is `john` and has a tag that contains `cs`.
* The following shows a list of allowed prefixes:
1. `n/` which represents the name
2. `s/` which represents the status
3. `p/` which represents the phone number
4. `e/` which represents the email
5. `a/` which represents the address
6. `t/` which represents the tags

Example:

`find n/amy t/cs2103 e/gmail` will return the list of contacts whose names are `amy`,
has a tag labeled `cs2103`, and whose emails contain `gmail`.

### Add an image for contacts

### Add image for contacts
Add a contact image for each contact.

Add a contact image for each contact
Format: `add-image INDEX [NAME-OF-IMAGE]`
Format: `add-image INDEX [PATH-TO-IMAGE]`

* Adds an image to the contact at the specified `INDEX`
* The index refers to the index number shown in the displayed person list.
* The index **must be a positive integer** 1, 2, 3,...
* The image must be placed in a specific folder for BookFace to locate
* If the image cannot be found or user did not specify a contact image, a default image will be used

> **Note:** The `[PATH-TO-IMAGE]` provided must be an absolute path, and should not be provided in quotation marks.
> For instance: `add-image 2 "C:/Users/user/Downloads/weekiat.png"` will be invalid, whereas
> `add-image 2 C:/Users/user/Downloads/weekiat.png` will be valid.
Examples:

* `list` followed by `add-image 2 weekiat.png` adds the image `weekiat.png` to the 2nd person in the address book
* `list` followed by `add-image 2 C:/Users/user/Downloads/weekiat.png` adds the image `weekiat.png` to the 2nd person in the address book

## Delete Image for contacts
### Delete an Image for contacts

Delete the image of a contact.

Format: `delete-image INDEX`

* Deletes the image of contact specified by `INDEX`
Expand All @@ -43,9 +136,10 @@ Format: `delete-image INDEX`
Example:
* `delete-image 2` deletes the image of the 2nd person in the address book.

## Quick Import for admin contacts: `import`
### Quick Import for admin contacts: `import`

Import administrative contacts for relevant faculties.

Format: `import [faculty]`

* Faculty acronyms (e.g. soc)
Expand All @@ -56,49 +150,7 @@ Example:
* `import soc` adds all important administrative contact for School of Computing
* `import chs` adds all important administrative contact for College of Humanities and Sciences


## Add user contacts: `add`

Format: `add [name] [year/course] [phone number] [email] [address]` Optional to add: `t/TAGS`

* User is *required* to enter **name, status, phone number, email, address**
* Tags can be optional
* If the account exists, user can add in related field of interests to share with others

Example:
* `add n/Shenghan s/Year2 Computer-science p/99999999 e/[email protected] a/punngol place 696a #12-348` will displays the
necessary basic information that are the user's name, year/course, phone number, email, address. Optional fields are tags,
for which there are commitment/cca tags, module tags and lastly the general tags for users to enter non-specific typed tags.

Example (with the addition of tags):
* `add n/Shenghan s/Year2 Computer-science p/99999999 e/[email protected] a/punngol place 696a #12-348 t/developer ct/soccer
mt/cs2103` Note that the tags can be placed in any part of the command, and it will not break!

Tags are categorised according to tag colors:
* Commitment tags: `coral pink`
* Module tags: `Dark green`
* General tags: `default blue`

## Delete user contacts: `delete`

Delete a contact.
Format: `delete INDEX`

* Show contact details specified by `INDEX`
* The index refers to the index number shown in the displayed person list.
* The index *must* be a positive integer 1, 2, 3, …
* Extra: Will prompt user to re-confirm again before the contact is erased from BookFace
Example:
* `delete 2` Brings up the 2nd person in the address book and prompt user to confirm before deleting.

## Help command: `help`

Show a list of command to help users to navigate around
Format: `help`

* Include list of commands to enable users to refer to in terminal.

-----------------------
---

## Command summary

Expand All @@ -110,7 +162,7 @@ Format: `help`
| **Find** | `find KEYWORD [MORE_KEYWORDS]`<br> e.g., `find James Jake` |
| **List** | `list` |
| **Help** | `help` |
| **Add-Image** | `add-image INDEX [NAME-OF-IMAGE]` <br> e.g., `add-image 2 weekiat.png` |
| **Add-Image** | `add-image INDEX [PATH-TO-IMAGE]` <br> e.g., `add-image 2 C:/Users/user/Downloads/weekiat.png` |
| **Delete-Image** | `delete-image INDEX` <br> e.g., `delete-image 2` | |
| **Import** | `import [faculty]` <br> e.g., `import soc, import chs` |

Binary file added docs/images/GUIOnInitialUsage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions src/main/java/seedu/address/commons/util/StringUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,15 @@ public class StringUtil {
public static boolean containsWordIgnoreCase(String sentence, String word) {
requireNonNull(sentence);
requireNonNull(word);

String preppedWord = word.trim();
String preppedWord = word.trim().toLowerCase();
checkArgument(!preppedWord.isEmpty(), "Word parameter cannot be empty");
checkArgument(preppedWord.split("\\s+").length == 1, "Word parameter should be a single word");

String preppedSentence = sentence;
String[] wordsInPreppedSentence = preppedSentence.split("\\s+");

return Arrays.stream(wordsInPreppedSentence)
.anyMatch(preppedWord::equalsIgnoreCase);
.anyMatch(wordInPreppedSentence -> wordInPreppedSentence.toLowerCase().contains(preppedWord));
}

/**
Expand Down
37 changes: 17 additions & 20 deletions src/main/java/seedu/address/logic/commands/FindCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,35 @@

import static java.util.Objects.requireNonNull;

import java.util.function.Predicate;

import seedu.address.commons.core.Messages;
import seedu.address.model.Model;
import seedu.address.model.person.NameContainsKeywordsPredicate;
import seedu.address.model.person.PhoneContainsKeywordsPredicate;
import seedu.address.model.person.Person;

/**
* Finds and lists all persons in address book whose name contains any of the argument keywords.
* Finds and lists all persons in address book whose details contains any of the
* argument keywords based on the prefixes in the user input.
* Keyword matching is case insensitive.
*/
public class FindCommand extends Command {

public static final String COMMAND_WORD = "find";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Finds all persons whose names contain any of "
+ "the specified keywords (case-insensitive) and displays them as a list with index numbers.\n"
+ "Parameters: KEYWORD [MORE_KEYWORDS]...\n"
+ "Example: " + COMMAND_WORD + " alice bob charlie";

public static final String MESSAGE_USAGE_2 = COMMAND_WORD + ": Finds all persons whose phone numbers contain any "
+ "of the specified keywords / phone number substring and displays them as a list with index numbers.\n"
+ "Parameters: KEYWORD [MORE_KEYWORDS]...\n"
+ "Example: " + COMMAND_WORD + " 99999999";

private NameContainsKeywordsPredicate predicate;
public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Finds all persons whose details contain any of "
+ "the specified keywords (case-insensitive) based on "
+ "the prefix provided and displays them as a list with index numbers.\n"
+ "Each prefix must be followed by one and only one keyword.\n"
+ "Please use the \"help\" command for more information on "
+ "the usage of this command.\n"
+ "Parameters: [PREFIX]/KEYWORD [MORE [PREFIX]/KEYWORD]...\n"
+ "Example: " + COMMAND_WORD + " n/alice s/y4 p/91234567"
+ " e/[email protected] a/blk 123 t/cs2103";

private PhoneContainsKeywordsPredicate phonePredicate;

public FindCommand(PhoneContainsKeywordsPredicate phonePredicate) {
this.phonePredicate = phonePredicate;
}
private Predicate<Person> predicate;

public FindCommand(NameContainsKeywordsPredicate predicate) {
public FindCommand(Predicate<Person> predicate) {
this.predicate = predicate;
}

Expand Down
Loading

0 comments on commit 342d5f2

Please sign in to comment.