Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Delete command UG, DG and messages #45

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,19 @@ Examples:

_{To be updated...}_

Deletes the specified contact from the address book.
Deletes the specified contact from the address book and its associated contacts if specified.
Format: `delete INDEX [--recursive]` or `delete --id ID [--recursive]`

Format: `delete INDEX`
* `INDEX` refers to the index number shown on the list and must be a positive integer.
* Deletes the person with id `ID` if specified, ignoring if the contact is shown in the list.
* Deletes other contacts associated under the selected contact if `--recursive` is used, ignoring if the contact is shown in the list.

Examples:
* `delete 1` deletes the 1st contact in the list of contacts shown.
* `delete --id 045f` deletes the contact with id `045f` in the address book.
* `delete 1 --recursive` deletes the 1st contact along with other contacts associated under it.

* Deletes the contact at the specified `INDEX`.
* The index refers to the index number shown in the displayed contact list.
* The index **must be a positive integer** 1, 2, 3, ...

Examples:
* `list` followed by `delete 2` deletes the 2nd contact in the address book.
* `find Betsy` followed by `delete 1` deletes the 1st contact in the results of the `find` command.


### Clearing all entries: `clear`
Expand Down Expand Up @@ -251,7 +252,7 @@ Action | Format, Examples
**Add Organization** | `add --type o[rganization] --name <NAME> [--id ID] [--phone NUMBER] [--email EMAIL] [--url URL] [--addr ADDRESS] [--stat STATUS] [--pos POSITION] [--tag TAG]...`<br> e.g., `add --type o --name NUS --phone 0123456789 --email example@nus.edu.sg --url https://www.nus.edu.sg/ --stat pending --pos Research`
**Add Recruiter** | `add --type r[ecruiter] --name <NAME> [--id ID] [--oid ORG_ID] [--phone NUMBER] [--email EMAIL] [--url URL] [--addr ADDRESS] [--tag TAG]...`<br> e.g., `add --name John Doe --type Recruiter --oid paypal-sg`
**Clear** | `clear`
**Delete** | `delete INDEX`<br> e.g., `delete 3`
**Delete** | `delete INDEX [--recursive]` or <br> `delete --id ID [--recursive]` <br> e.g., `delete 3`, `delete --id 55tg`
**Edit** | Coming soon...
**Find** | `find KEYWORD [MORE_KEYWORDS]`<br> e.g., `find James Jake`
**List** | `list`
Expand Down
12 changes: 10 additions & 2 deletions src/main/java/seedu/address/logic/commands/DeleteCommand.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package seedu.address.logic.commands;

import static java.util.Objects.requireNonNull;
import static seedu.address.logic.parser.CliSyntax.FLAG_ID;
import static seedu.address.logic.parser.CliSyntax.FLAG_RECURSIVE;

import java.util.List;
import java.util.function.Function;
Expand All @@ -22,8 +24,14 @@ public class DeleteCommand extends Command {

public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Deletes the contact identified by the index number used in the displayed contact list.\n"
+ "Parameters: INDEX (must be a positive integer)\n"
+ "Example: " + COMMAND_WORD + " 1";
+ "Parameters: "
+ "INDEX (must be a positive integer) "
+ FLAG_ID + " ID "
+ FLAG_RECURSIVE + " RECURSIVE "
+ "\n"
+ "Example 1: " + COMMAND_WORD + " 1\n"
+ "Example 2: " + COMMAND_WORD + " --id 0d0h4\n"
+ "Example 3: " + COMMAND_WORD + " 1 --recursive\n";

public static final String MESSAGE_DELETE_CONTACT_SUCCESS = "Deleted Contact: %1$s";

Expand Down