From 4951d261643b8bc89ab37a44e51ef3eda0e6ec7c Mon Sep 17 00:00:00 2001 From: FongYuan <42345573+FongYuan@users.noreply.github.com> Date: Fri, 7 Sep 2018 12:33:19 +0800 Subject: [PATCH 1/9] Add an isAnyNullTest() to test the Utils.isAnyNull() method. --- test/java/seedu/addressbook/common/UtilsTest.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/java/seedu/addressbook/common/UtilsTest.java b/test/java/seedu/addressbook/common/UtilsTest.java index 23ea62b45..8cf25a186 100644 --- a/test/java/seedu/addressbook/common/UtilsTest.java +++ b/test/java/seedu/addressbook/common/UtilsTest.java @@ -36,6 +36,11 @@ public void elementsAreUnique() throws Exception { assertNotUnique(null, "a", "b", null); } + @Test + public void isAnyNullTest() { + assertFalse(Utils.isAnyNull()); + } + private void assertAreUnique(Object... objects) { assertTrue(Utils.elementsAreUnique(Arrays.asList(objects))); } From bb32fd1a882212102c37f795db0fa7597913771c Mon Sep 17 00:00:00 2001 From: FongYuan <42345573+FongYuan@users.noreply.github.com> Date: Thu, 13 Sep 2018 15:22:18 +0800 Subject: [PATCH 2/9] Format the clear command in the help display like the rest of the commands. --- src/seedu/addressbook/commands/ClearCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/seedu/addressbook/commands/ClearCommand.java b/src/seedu/addressbook/commands/ClearCommand.java index 6f88f8e13..281ee2572 100644 --- a/src/seedu/addressbook/commands/ClearCommand.java +++ b/src/seedu/addressbook/commands/ClearCommand.java @@ -6,7 +6,7 @@ public class ClearCommand extends Command { public static final String COMMAND_WORD = "clear"; - public static final String MESSAGE_USAGE = "Clears address book permanently.\n" + public static final String MESSAGE_USAGE = COMMAND_WORD + ": Clears address book permanently.\n" + "Example: " + COMMAND_WORD; public static final String MESSAGE_SUCCESS = "Address book has been cleared!"; From bf2d7f26e07b795ae7683fd28603cc3425112ee5 Mon Sep 17 00:00:00 2001 From: FongYuan <42345573+FongYuan@users.noreply.github.com> Date: Thu, 13 Sep 2018 19:10:53 +0800 Subject: [PATCH 3/9] Update test/expected.txt to reflect the change in output. --- test/expected.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/expected.txt b/test/expected.txt index 56fe5fcac..17971a5ef 100644 --- a/test/expected.txt +++ b/test/expected.txt @@ -12,7 +12,7 @@ || delete: Deletes the person identified by the index number used in the last person listing. || Parameters: INDEX || Example: delete 1 -|| Clears address book permanently. +|| clear: Clears address book permanently. || Example: clear || find: Finds all persons whose names contain any of the specified keywords (case-sensitive) and displays them as a list with index numbers. || Parameters: KEYWORD [MORE_KEYWORDS]... From 472c06d8032966f2d3eb7b24125e5404da9c8fbe Mon Sep 17 00:00:00 2001 From: FongYuan <42345573+FongYuan@users.noreply.github.com> Date: Thu, 13 Sep 2018 19:55:07 +0800 Subject: [PATCH 4/9] Add getMessageUsage() method to Command and convert AddCommand as a sample. --- .../addressbook/commands/AddCommand.java | 8 ++++++-- src/seedu/addressbook/commands/Command.java | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/seedu/addressbook/commands/AddCommand.java b/src/seedu/addressbook/commands/AddCommand.java index ac307f1b2..dce86a126 100644 --- a/src/seedu/addressbook/commands/AddCommand.java +++ b/src/seedu/addressbook/commands/AddCommand.java @@ -20,11 +20,15 @@ public class AddCommand extends Command { public static final String COMMAND_WORD = "add"; - public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a person to the address book. " + public static final String MESSAGE_USAGE = Command.getMessageUsage(COMMAND_WORD, + "Adds a person to the address book. Contact details can be marked private by prepending 'p' to the prefix.", + "NAME [p]p/PHONE [p]e/EMAIL [p]a/ADDRESS [t/TAG]...", + "John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney"); + /*COMMAND_WORD + ": Adds a person to the address book. " + "Contact details can be marked private by prepending 'p' to the prefix.\n" + "Parameters: NAME [p]p/PHONE [p]e/EMAIL [p]a/ADDRESS [t/TAG]...\n" + "Example: " + COMMAND_WORD - + " John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney"; + + " John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney";*/ public static final String MESSAGE_SUCCESS = "New person added: %1$s"; public static final String MESSAGE_DUPLICATE_PERSON = "This person already exists in the address book"; diff --git a/src/seedu/addressbook/commands/Command.java b/src/seedu/addressbook/commands/Command.java index 2ff8f1575..f4433aff7 100644 --- a/src/seedu/addressbook/commands/Command.java +++ b/src/seedu/addressbook/commands/Command.java @@ -26,6 +26,25 @@ public Command(int targetIndex) { protected Command() { } + /** + * Generates the MESSAGE_USAGE for a command. + * @param commandWord The command's COMMAND_WORD + * @param commandDesc A brief description of what the command does + * @param commandParams The list of parameters the command accepts, or "none" if the command has no parameters + * @param commandEgParams An example of a set of valid parameter values to pass to the command, give "" if the command has no parameters + * @return the MESSAGE_USAGE for a command. + */ + protected static String getMessageUsage( + String commandWord, + String commandDesc, + String commandParams, + String commandEgParams) { + + return commandWord + ": " + commandDesc + "\n" + + "Parameters: " + commandParams + "\n" + + "Example: " + commandWord + " " + commandEgParams + "\n"; + } + /** * Constructs a feedback message to summarise an operation that displayed a listing of persons. * From 9a7b50b1a990d1b46f9287b83569d0fb3e377bc6 Mon Sep 17 00:00:00 2001 From: FongYuan <42345573+FongYuan@users.noreply.github.com> Date: Thu, 13 Sep 2018 20:26:10 +0800 Subject: [PATCH 5/9] Update the rest of the commands to use getMessageUsage(). --- src/seedu/addressbook/commands/AddCommand.java | 5 ----- src/seedu/addressbook/commands/ClearCommand.java | 6 ++++-- src/seedu/addressbook/commands/DeleteCommand.java | 8 ++++---- src/seedu/addressbook/commands/ExitCommand.java | 7 +++++-- src/seedu/addressbook/commands/FindCommand.java | 8 ++++---- src/seedu/addressbook/commands/HelpCommand.java | 6 ++++-- src/seedu/addressbook/commands/ListCommand.java | 7 ++++--- src/seedu/addressbook/commands/ViewAllCommand.java | 8 ++++---- src/seedu/addressbook/commands/ViewCommand.java | 8 ++++---- 9 files changed, 33 insertions(+), 30 deletions(-) diff --git a/src/seedu/addressbook/commands/AddCommand.java b/src/seedu/addressbook/commands/AddCommand.java index dce86a126..46d852395 100644 --- a/src/seedu/addressbook/commands/AddCommand.java +++ b/src/seedu/addressbook/commands/AddCommand.java @@ -24,11 +24,6 @@ public class AddCommand extends Command { "Adds a person to the address book. Contact details can be marked private by prepending 'p' to the prefix.", "NAME [p]p/PHONE [p]e/EMAIL [p]a/ADDRESS [t/TAG]...", "John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney"); - /*COMMAND_WORD + ": Adds a person to the address book. " - + "Contact details can be marked private by prepending 'p' to the prefix.\n" - + "Parameters: NAME [p]p/PHONE [p]e/EMAIL [p]a/ADDRESS [t/TAG]...\n" - + "Example: " + COMMAND_WORD - + " John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney";*/ public static final String MESSAGE_SUCCESS = "New person added: %1$s"; public static final String MESSAGE_DUPLICATE_PERSON = "This person already exists in the address book"; diff --git a/src/seedu/addressbook/commands/ClearCommand.java b/src/seedu/addressbook/commands/ClearCommand.java index 281ee2572..b3eefbae2 100644 --- a/src/seedu/addressbook/commands/ClearCommand.java +++ b/src/seedu/addressbook/commands/ClearCommand.java @@ -6,8 +6,10 @@ public class ClearCommand extends Command { public static final String COMMAND_WORD = "clear"; - public static final String MESSAGE_USAGE = COMMAND_WORD + ": Clears address book permanently.\n" - + "Example: " + COMMAND_WORD; + public static final String MESSAGE_USAGE = Command.getMessageUsage(COMMAND_WORD, + "Clears address book permanently.", + "none", + ""); public static final String MESSAGE_SUCCESS = "Address book has been cleared!"; diff --git a/src/seedu/addressbook/commands/DeleteCommand.java b/src/seedu/addressbook/commands/DeleteCommand.java index 493d75da6..1fa53df5e 100644 --- a/src/seedu/addressbook/commands/DeleteCommand.java +++ b/src/seedu/addressbook/commands/DeleteCommand.java @@ -12,10 +12,10 @@ public class DeleteCommand extends Command { public static final String COMMAND_WORD = "delete"; - public static final String MESSAGE_USAGE = COMMAND_WORD - + ": Deletes the person identified by the index number used in the last person listing.\n" - + "Parameters: INDEX\n" - + "Example: " + COMMAND_WORD + " 1"; + public static final String MESSAGE_USAGE = Command.getMessageUsage(COMMAND_WORD, + "Deletes the person identified by the index number used in the last person listing.", + "INDEX", + "1"); public static final String MESSAGE_DELETE_PERSON_SUCCESS = "Deleted Person: %1$s"; diff --git a/src/seedu/addressbook/commands/ExitCommand.java b/src/seedu/addressbook/commands/ExitCommand.java index 2f280395c..7ef76a32f 100644 --- a/src/seedu/addressbook/commands/ExitCommand.java +++ b/src/seedu/addressbook/commands/ExitCommand.java @@ -7,8 +7,11 @@ public class ExitCommand extends Command { public static final String COMMAND_WORD = "exit"; - public static final String MESSAGE_USAGE = COMMAND_WORD + ": Exits the program.\n" - + "Example: " + COMMAND_WORD; + public static final String MESSAGE_USAGE = Command.getMessageUsage(COMMAND_WORD, + "Exits the program.", + "none", + ""); + public static final String MESSAGE_EXIT_ACKNOWEDGEMENT = "Exiting Address Book as requested ..."; @Override diff --git a/src/seedu/addressbook/commands/FindCommand.java b/src/seedu/addressbook/commands/FindCommand.java index 7fe2c52c3..38bef4f4b 100644 --- a/src/seedu/addressbook/commands/FindCommand.java +++ b/src/seedu/addressbook/commands/FindCommand.java @@ -16,10 +16,10 @@ 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-sensitive) 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 = Command.getMessageUsage(COMMAND_WORD, + "Finds all persons whose names contain any of the specified keywords (case-sensitive) and displays them as a list with index numbers.", + "KEYWORD [MORE_KEYWORDS]...", + "alice bob charlie"); private final Set keywords; diff --git a/src/seedu/addressbook/commands/HelpCommand.java b/src/seedu/addressbook/commands/HelpCommand.java index 9be217d89..07730f994 100644 --- a/src/seedu/addressbook/commands/HelpCommand.java +++ b/src/seedu/addressbook/commands/HelpCommand.java @@ -8,8 +8,10 @@ public class HelpCommand extends Command { public static final String COMMAND_WORD = "help"; - public static final String MESSAGE_USAGE = COMMAND_WORD + ": Shows program usage instructions.\n" - + "Example: " + COMMAND_WORD; + public static final String MESSAGE_USAGE = Command.getMessageUsage(COMMAND_WORD, + "Shows program usage instructions.", + "none", + ""); @Override public CommandResult execute() { diff --git a/src/seedu/addressbook/commands/ListCommand.java b/src/seedu/addressbook/commands/ListCommand.java index d76d48297..ae75aba66 100644 --- a/src/seedu/addressbook/commands/ListCommand.java +++ b/src/seedu/addressbook/commands/ListCommand.java @@ -12,9 +12,10 @@ public class ListCommand extends Command { public static final String COMMAND_WORD = "list"; - public static final String MESSAGE_USAGE = COMMAND_WORD - + ": Displays all persons in the address book as a list with index numbers.\n" - + "Example: " + COMMAND_WORD; + public static final String MESSAGE_USAGE = Command.getMessageUsage(COMMAND_WORD, + "Displays all persons in the address book as a list with index numbers.", + "none", + ""); @Override diff --git a/src/seedu/addressbook/commands/ViewAllCommand.java b/src/seedu/addressbook/commands/ViewAllCommand.java index 0067304bb..5ea28ac86 100644 --- a/src/seedu/addressbook/commands/ViewAllCommand.java +++ b/src/seedu/addressbook/commands/ViewAllCommand.java @@ -12,10 +12,10 @@ public class ViewAllCommand extends Command { public static final String COMMAND_WORD = "viewall"; - public static final String MESSAGE_USAGE = COMMAND_WORD + ": Views the non-private details of the person " - + "identified by the index number in the last shown person listing.\n" - + "Parameters: INDEX\n" - + "Example: " + COMMAND_WORD + " 1"; + public static final String MESSAGE_USAGE = Command.getMessageUsage(COMMAND_WORD, + "Views the non-private details of the person identified by the index number in the last shown person listing.", + "INDEX", + "1"); public static final String MESSAGE_VIEW_PERSON_DETAILS = "Viewing person: %1$s"; diff --git a/src/seedu/addressbook/commands/ViewCommand.java b/src/seedu/addressbook/commands/ViewCommand.java index 69335c849..21dc7e4f6 100644 --- a/src/seedu/addressbook/commands/ViewCommand.java +++ b/src/seedu/addressbook/commands/ViewCommand.java @@ -12,10 +12,10 @@ public class ViewCommand extends Command { public static final String COMMAND_WORD = "view"; - public static final String MESSAGE_USAGE = COMMAND_WORD + ": Views the non-private details of the person " - + "identified by the index number in the last shown person listing.\n" - + "Parameters: INDEX\n" - + "Example: " + COMMAND_WORD + " 1"; + public static final String MESSAGE_USAGE = Command.getMessageUsage(COMMAND_WORD, + "Views the non-private details of the person identified by the index number in the last shown person listing.", + "INDEX", + "1"); public static final String MESSAGE_VIEW_PERSON_DETAILS = "Viewing person: %1$s"; From 8bfa4cb2728fe5d87b91ee070847af5c93774fed Mon Sep 17 00:00:00 2001 From: FongYuan <42345573+FongYuan@users.noreply.github.com> Date: Thu, 13 Sep 2018 20:29:53 +0800 Subject: [PATCH 6/9] Remove the extra newline characters in the help command. --- src/seedu/addressbook/commands/HelpCommand.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/seedu/addressbook/commands/HelpCommand.java b/src/seedu/addressbook/commands/HelpCommand.java index 07730f994..c1780a2a7 100644 --- a/src/seedu/addressbook/commands/HelpCommand.java +++ b/src/seedu/addressbook/commands/HelpCommand.java @@ -17,14 +17,14 @@ public class HelpCommand extends Command { public CommandResult execute() { return new CommandResult( AddCommand.MESSAGE_USAGE - + "\n" + DeleteCommand.MESSAGE_USAGE - + "\n" + ClearCommand.MESSAGE_USAGE - + "\n" + FindCommand.MESSAGE_USAGE - + "\n" + ListCommand.MESSAGE_USAGE - + "\n" + ViewCommand.MESSAGE_USAGE - + "\n" + ViewAllCommand.MESSAGE_USAGE - + "\n" + HelpCommand.MESSAGE_USAGE - + "\n" + ExitCommand.MESSAGE_USAGE + + DeleteCommand.MESSAGE_USAGE + + ClearCommand.MESSAGE_USAGE + + FindCommand.MESSAGE_USAGE + + ListCommand.MESSAGE_USAGE + + ViewCommand.MESSAGE_USAGE + + ViewAllCommand.MESSAGE_USAGE + + HelpCommand.MESSAGE_USAGE + + ExitCommand.MESSAGE_USAGE ); } } From f58b101e6733f564f50f8184a31773d770ea42ed Mon Sep 17 00:00:00 2001 From: FongYuan <42345573+FongYuan@users.noreply.github.com> Date: Thu, 13 Sep 2018 20:42:45 +0800 Subject: [PATCH 7/9] Re-add the newline characters in the help command, and removed the newline and added indentation for Command.getMessageUsage(). --- src/seedu/addressbook/commands/Command.java | 4 +- .../addressbook/commands/HelpCommand.java | 16 +- test/expected.txt | 614 +++++++++--------- 3 files changed, 319 insertions(+), 315 deletions(-) diff --git a/src/seedu/addressbook/commands/Command.java b/src/seedu/addressbook/commands/Command.java index f4433aff7..826d309b4 100644 --- a/src/seedu/addressbook/commands/Command.java +++ b/src/seedu/addressbook/commands/Command.java @@ -41,8 +41,8 @@ protected static String getMessageUsage( String commandEgParams) { return commandWord + ": " + commandDesc + "\n" - + "Parameters: " + commandParams + "\n" - + "Example: " + commandWord + " " + commandEgParams + "\n"; + + " Parameters: " + commandParams + "\n" + + " Example: " + commandWord + " " + commandEgParams; } /** diff --git a/src/seedu/addressbook/commands/HelpCommand.java b/src/seedu/addressbook/commands/HelpCommand.java index c1780a2a7..07730f994 100644 --- a/src/seedu/addressbook/commands/HelpCommand.java +++ b/src/seedu/addressbook/commands/HelpCommand.java @@ -17,14 +17,14 @@ public class HelpCommand extends Command { public CommandResult execute() { return new CommandResult( AddCommand.MESSAGE_USAGE - + DeleteCommand.MESSAGE_USAGE - + ClearCommand.MESSAGE_USAGE - + FindCommand.MESSAGE_USAGE - + ListCommand.MESSAGE_USAGE - + ViewCommand.MESSAGE_USAGE - + ViewAllCommand.MESSAGE_USAGE - + HelpCommand.MESSAGE_USAGE - + ExitCommand.MESSAGE_USAGE + + "\n" + DeleteCommand.MESSAGE_USAGE + + "\n" + ClearCommand.MESSAGE_USAGE + + "\n" + FindCommand.MESSAGE_USAGE + + "\n" + ListCommand.MESSAGE_USAGE + + "\n" + ViewCommand.MESSAGE_USAGE + + "\n" + ViewAllCommand.MESSAGE_USAGE + + "\n" + HelpCommand.MESSAGE_USAGE + + "\n" + ExitCommand.MESSAGE_USAGE ); } } diff --git a/test/expected.txt b/test/expected.txt index 17971a5ef..3f7540bd5 100644 --- a/test/expected.txt +++ b/test/expected.txt @@ -1,305 +1,309 @@ -|| =================================================== -|| =================================================== -|| Welcome to your Address Book! -|| AddressBook Level 2 - Version 1.0 -|| Launch command format: java seedu.addressbook.Main [STORAGE_FILE_PATH] -|| Using storage file : addressbook.txt -|| =================================================== -|| Enter command: || [Command entered: sfdfd] -|| add: Adds a person to the address book. Contact details can be marked private by prepending 'p' to the prefix. -|| Parameters: NAME [p]p/PHONE [p]e/EMAIL [p]a/ADDRESS [t/TAG]... -|| Example: add John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney -|| delete: Deletes the person identified by the index number used in the last person listing. -|| Parameters: INDEX -|| Example: delete 1 -|| clear: Clears address book permanently. -|| Example: clear -|| find: Finds all persons whose names contain any of the specified keywords (case-sensitive) and displays them as a list with index numbers. -|| Parameters: KEYWORD [MORE_KEYWORDS]... -|| Example: find alice bob charlie -|| list: Displays all persons in the address book as a list with index numbers. -|| Example: list -|| view: Views the non-private details of the person identified by the index number in the last shown person listing. -|| Parameters: INDEX -|| Example: view 1 -|| viewall: Views the non-private details of the person identified by the index number in the last shown person listing. -|| Parameters: INDEX -|| Example: viewall 1 -|| help: Shows program usage instructions. -|| Example: help -|| exit: Exits the program. -|| Example: exit -|| =================================================== -|| Enter command: || [Command entered: delete 1] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: view 1] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: viewall 1] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: clear] -|| Address book has been cleared! -|| =================================================== -|| Enter command: || [Command entered: list] -|| -|| 0 persons listed! -|| =================================================== -|| Enter command: || [Command entered: add wrong args wrong args] -|| Invalid command format! -|| add: Adds a person to the address book. Contact details can be marked private by prepending 'p' to the prefix. -|| Parameters: NAME [p]p/PHONE [p]e/EMAIL [p]a/ADDRESS [t/TAG]... -|| Example: add John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney -|| =================================================== -|| Enter command: || [Command entered: add Valid Name 12345 e/valid@email.butNoPhonePrefix a/valid, address] -|| Invalid command format! -|| add: Adds a person to the address book. Contact details can be marked private by prepending 'p' to the prefix. -|| Parameters: NAME [p]p/PHONE [p]e/EMAIL [p]a/ADDRESS [t/TAG]... -|| Example: add John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney -|| =================================================== -|| Enter command: || [Command entered: add Valid Name p/12345 valid@email.butNoPrefix a/valid, address] -|| Invalid command format! -|| add: Adds a person to the address book. Contact details can be marked private by prepending 'p' to the prefix. -|| Parameters: NAME [p]p/PHONE [p]e/EMAIL [p]a/ADDRESS [t/TAG]... -|| Example: add John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney -|| =================================================== -|| Enter command: || [Command entered: add Valid Name p/12345 e/valid@email.butNoAddressPrefix valid, address] -|| Invalid command format! -|| add: Adds a person to the address book. Contact details can be marked private by prepending 'p' to the prefix. -|| Parameters: NAME [p]p/PHONE [p]e/EMAIL [p]a/ADDRESS [t/TAG]... -|| Example: add John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney -|| =================================================== -|| Enter command: || [Command entered: add Valid Name p/12345 e/valid@email.butNoTagPrefix a/valid, address t/goodTag noPrefixTag] -|| Tags names should be alphanumeric -|| =================================================== -|| Enter command: || [Command entered: add []\[;] p/12345 e/valid@e.mail a/valid, address] -|| Person names should be spaces or alphabetic characters -|| =================================================== -|| Enter command: || [Command entered: add Valid Name p/not_numbers e/valid@e.mail a/valid, address] -|| Person phone numbers should only contain numbers -|| =================================================== -|| Enter command: || [Command entered: add Valid Name p/12345 e/notAnEmail a/valid, address] -|| Person emails should be 2 alphanumeric/period strings separated by '@' -|| =================================================== -|| Enter command: || [Command entered: add Valid Name p/12345 e/valid@e.mail a/valid, address t/invalid_-[.tag] -|| Tags names should be alphanumeric -|| =================================================== -|| Enter command: || [Command entered: add Adam Brown p/111111 e/adam@gmail.com a/111, alpha street] -|| New person added: Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: -|| =================================================== -|| Enter command: || [Command entered: list] -|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: -|| -|| 1 persons listed! -|| =================================================== -|| Enter command: || [Command entered: add Betsy Choo pp/222222 pe/benchoo@nus.edu.sg pa/222, beta street t/secretive] -|| New person added: Betsy Choo Phone: (private) 222222 Email: (private) benchoo@nus.edu.sg Address: (private) 222, beta street Tags: [secretive] -|| =================================================== -|| Enter command: || [Command entered: list] -|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: -|| 2. Betsy Choo Tags: [secretive] -|| -|| 2 persons listed! -|| =================================================== -|| Enter command: || [Command entered: add Charlie Dickson pp/333333 e/charlie.d@nus.edu.sg a/333, gamma street t/friends t/school] -|| New person added: Charlie Dickson Phone: (private) 333333 Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] -|| =================================================== -|| Enter command: || [Command entered: list] -|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: -|| 2. Betsy Choo Tags: [secretive] -|| 3. Charlie Dickson Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] -|| -|| 3 persons listed! -|| =================================================== -|| Enter command: || [Command entered: add Dickson Ee p/444444 pe/dickson@nus.edu.sg a/444, delta street t/friends] -|| New person added: Dickson Ee Phone: 444444 Email: (private) dickson@nus.edu.sg Address: 444, delta street Tags: [friends] -|| =================================================== -|| Enter command: || [Command entered: list] -|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: -|| 2. Betsy Choo Tags: [secretive] -|| 3. Charlie Dickson Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] -|| 4. Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] -|| -|| 4 persons listed! -|| =================================================== -|| Enter command: || [Command entered: add Esther Potato p/555555 e/esther@not.a.real.potato pa/555, epsilon street t/tubers t/starchy] -|| New person added: Esther Potato Phone: 555555 Email: esther@not.a.real.potato Address: (private) 555, epsilon street Tags: [tubers][starchy] -|| =================================================== -|| Enter command: || [Command entered: list] -|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: -|| 2. Betsy Choo Tags: [secretive] -|| 3. Charlie Dickson Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] -|| 4. Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] -|| 5. Esther Potato Phone: 555555 Email: esther@not.a.real.potato Tags: [tubers][starchy] -|| -|| 5 persons listed! -|| =================================================== -|| Enter command: || [Command entered: add Esther Potato p/555555 e/esther@not.a.real.potato pa/555, epsilon street t/tubers t/starchy] -|| This person already exists in the address book -|| =================================================== -|| Enter command: || [Command entered: view] -|| Invalid command format! -|| view: Views the non-private details of the person identified by the index number in the last shown person listing. -|| Parameters: INDEX -|| Example: view 1 -|| =================================================== -|| Enter command: || [Command entered: viewall] -|| Invalid command format! -|| viewall: Views the non-private details of the person identified by the index number in the last shown person listing. -|| Parameters: INDEX -|| Example: viewall 1 -|| =================================================== -|| Enter command: || [Command entered: view should be only one number] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: viewall should only be one number] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: view -1] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: view 0] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: view 6] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: viewall -1] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: viewall 0] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: viewall 6] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: view 1] -|| Viewing person: Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: -|| =================================================== -|| Enter command: || [Command entered: viewall 1] -|| Viewing person: Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: -|| =================================================== -|| Enter command: || [Command entered: view 3] -|| Viewing person: Charlie Dickson Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] -|| =================================================== -|| Enter command: || [Command entered: view 4] -|| Viewing person: Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] -|| =================================================== -|| Enter command: || [Command entered: view 5] -|| Viewing person: Esther Potato Phone: 555555 Email: esther@not.a.real.potato Tags: [tubers][starchy] -|| =================================================== -|| Enter command: || [Command entered: viewall 3] -|| Viewing person: Charlie Dickson Phone: (private) 333333 Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] -|| =================================================== -|| Enter command: || [Command entered: viewall 4] -|| Viewing person: Dickson Ee Phone: 444444 Email: (private) dickson@nus.edu.sg Address: 444, delta street Tags: [friends] -|| =================================================== -|| Enter command: || [Command entered: viewall 5] -|| Viewing person: Esther Potato Phone: 555555 Email: esther@not.a.real.potato Address: (private) 555, epsilon street Tags: [tubers][starchy] -|| =================================================== -|| Enter command: || [Command entered: find] -|| Invalid command format! -|| find: Finds all persons whose names contain any of the specified keywords (case-sensitive) and displays them as a list with index numbers. -|| Parameters: KEYWORD [MORE_KEYWORDS]... -|| Example: find alice bob charlie -|| =================================================== -|| Enter command: || [Command entered: find bet] -|| -|| 0 persons listed! -|| =================================================== -|| Enter command: || [Command entered: find 23912039120] -|| -|| 0 persons listed! -|| =================================================== -|| Enter command: || [Command entered: find betsy] -|| -|| 0 persons listed! -|| =================================================== -|| Enter command: || [Command entered: find Betsy] -|| 1. Betsy Choo Tags: [secretive] -|| -|| 1 persons listed! -|| =================================================== -|| Enter command: || [Command entered: find Dickson] -|| 1. Charlie Dickson Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] -|| 2. Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] -|| -|| 2 persons listed! -|| =================================================== -|| Enter command: || [Command entered: find Charlie Betsy] -|| 1. Betsy Choo Tags: [secretive] -|| 2. Charlie Dickson Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] -|| -|| 2 persons listed! -|| =================================================== -|| Enter command: || [Command entered: delete] -|| Invalid command format! -|| delete: Deletes the person identified by the index number used in the last person listing. -|| Parameters: INDEX -|| Example: delete 1 -|| =================================================== -|| Enter command: || [Command entered: delete should be only one number] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: delete -1] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: delete 0] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: delete 3] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: delete 2] -|| Deleted Person: Charlie Dickson Phone: (private) 333333 Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] -|| =================================================== -|| Enter command: || [Command entered: delete 2] -|| Person could not be found in address book -|| =================================================== -|| Enter command: || [Command entered: view 2] -|| Person could not be found in address book -|| =================================================== -|| Enter command: || [Command entered: viewall 2] -|| Person could not be found in address book -|| =================================================== -|| Enter command: || [Command entered: list] -|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: -|| 2. Betsy Choo Tags: [secretive] -|| 3. Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] -|| 4. Esther Potato Phone: 555555 Email: esther@not.a.real.potato Tags: [tubers][starchy] -|| -|| 4 persons listed! -|| =================================================== -|| Enter command: || [Command entered: delete 4] -|| Deleted Person: Esther Potato Phone: 555555 Email: esther@not.a.real.potato Address: (private) 555, epsilon street Tags: [tubers][starchy] -|| =================================================== -|| Enter command: || [Command entered: list] -|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: -|| 2. Betsy Choo Tags: [secretive] -|| 3. Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] -|| -|| 3 persons listed! -|| =================================================== -|| Enter command: || [Command entered: delete 1] -|| Deleted Person: Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: -|| =================================================== -|| Enter command: || [Command entered: list] -|| 1. Betsy Choo Tags: [secretive] -|| 2. Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] -|| -|| 2 persons listed! -|| =================================================== -|| Enter command: || [Command entered: clear] -|| Address book has been cleared! -|| =================================================== -|| Enter command: || [Command entered: list] -|| -|| 0 persons listed! -|| =================================================== -|| Enter command: || [Command entered: exit] -|| Exiting Address Book as requested ... -|| =================================================== -|| Good bye! -|| =================================================== -|| =================================================== +|| =================================================== +|| =================================================== +|| Welcome to your Address Book! +|| AddressBook Level 2 - Version 1.0 +|| Launch command format: java seedu.addressbook.Main [STORAGE_FILE_PATH] +|| Using storage file : addressbook.txt +|| =================================================== +|| Enter command: || [Command entered: sfdfd] +|| add: Adds a person to the address book. Contact details can be marked private by prepending 'p' to the prefix. +|| Parameters: NAME [p]p/PHONE [p]e/EMAIL [p]a/ADDRESS [t/TAG]... +|| Example: add John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney +|| delete: Deletes the person identified by the index number used in the last person listing. +|| Parameters: INDEX +|| Example: delete 1 +|| clear: Clears address book permanently. +|| Parameters: none +|| Example: clear +|| find: Finds all persons whose names contain any of the specified keywords (case-sensitive) and displays them as a list with index numbers. +|| Parameters: KEYWORD [MORE_KEYWORDS]... +|| Example: find alice bob charlie +|| list: Displays all persons in the address book as a list with index numbers. +|| Parameters: none +|| Example: list +|| view: Views the non-private details of the person identified by the index number in the last shown person listing. +|| Parameters: INDEX +|| Example: view 1 +|| viewall: Views the non-private details of the person identified by the index number in the last shown person listing. +|| Parameters: INDEX +|| Example: viewall 1 +|| help: Shows program usage instructions. +|| Parameters: none +|| Example: help +|| exit: Exits the program. +|| Parameters: none +|| Example: exit +|| =================================================== +|| Enter command: || [Command entered: delete 1] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: view 1] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: viewall 1] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: clear] +|| Address book has been cleared! +|| =================================================== +|| Enter command: || [Command entered: list] +|| +|| 0 persons listed! +|| =================================================== +|| Enter command: || [Command entered: add wrong args wrong args] +|| Invalid command format! +|| add: Adds a person to the address book. Contact details can be marked private by prepending 'p' to the prefix. +|| Parameters: NAME [p]p/PHONE [p]e/EMAIL [p]a/ADDRESS [t/TAG]... +|| Example: add John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney +|| =================================================== +|| Enter command: || [Command entered: add Valid Name 12345 e/valid@email.butNoPhonePrefix a/valid, address] +|| Invalid command format! +|| add: Adds a person to the address book. Contact details can be marked private by prepending 'p' to the prefix. +|| Parameters: NAME [p]p/PHONE [p]e/EMAIL [p]a/ADDRESS [t/TAG]... +|| Example: add John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney +|| =================================================== +|| Enter command: || [Command entered: add Valid Name p/12345 valid@email.butNoPrefix a/valid, address] +|| Invalid command format! +|| add: Adds a person to the address book. Contact details can be marked private by prepending 'p' to the prefix. +|| Parameters: NAME [p]p/PHONE [p]e/EMAIL [p]a/ADDRESS [t/TAG]... +|| Example: add John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney +|| =================================================== +|| Enter command: || [Command entered: add Valid Name p/12345 e/valid@email.butNoAddressPrefix valid, address] +|| Invalid command format! +|| add: Adds a person to the address book. Contact details can be marked private by prepending 'p' to the prefix. +|| Parameters: NAME [p]p/PHONE [p]e/EMAIL [p]a/ADDRESS [t/TAG]... +|| Example: add John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney +|| =================================================== +|| Enter command: || [Command entered: add Valid Name p/12345 e/valid@email.butNoTagPrefix a/valid, address t/goodTag noPrefixTag] +|| Tags names should be alphanumeric +|| =================================================== +|| Enter command: || [Command entered: add []\[;] p/12345 e/valid@e.mail a/valid, address] +|| Person names should be spaces or alphabetic characters +|| =================================================== +|| Enter command: || [Command entered: add Valid Name p/not_numbers e/valid@e.mail a/valid, address] +|| Person phone numbers should only contain numbers +|| =================================================== +|| Enter command: || [Command entered: add Valid Name p/12345 e/notAnEmail a/valid, address] +|| Person emails should be 2 alphanumeric/period strings separated by '@' +|| =================================================== +|| Enter command: || [Command entered: add Valid Name p/12345 e/valid@e.mail a/valid, address t/invalid_-[.tag] +|| Tags names should be alphanumeric +|| =================================================== +|| Enter command: || [Command entered: add Adam Brown p/111111 e/adam@gmail.com a/111, alpha street] +|| New person added: Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: +|| =================================================== +|| Enter command: || [Command entered: list] +|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: +|| +|| 1 persons listed! +|| =================================================== +|| Enter command: || [Command entered: add Betsy Choo pp/222222 pe/benchoo@nus.edu.sg pa/222, beta street t/secretive] +|| New person added: Betsy Choo Phone: (private) 222222 Email: (private) benchoo@nus.edu.sg Address: (private) 222, beta street Tags: [secretive] +|| =================================================== +|| Enter command: || [Command entered: list] +|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: +|| 2. Betsy Choo Tags: [secretive] +|| +|| 2 persons listed! +|| =================================================== +|| Enter command: || [Command entered: add Charlie Dickson pp/333333 e/charlie.d@nus.edu.sg a/333, gamma street t/friends t/school] +|| New person added: Charlie Dickson Phone: (private) 333333 Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] +|| =================================================== +|| Enter command: || [Command entered: list] +|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: +|| 2. Betsy Choo Tags: [secretive] +|| 3. Charlie Dickson Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] +|| +|| 3 persons listed! +|| =================================================== +|| Enter command: || [Command entered: add Dickson Ee p/444444 pe/dickson@nus.edu.sg a/444, delta street t/friends] +|| New person added: Dickson Ee Phone: 444444 Email: (private) dickson@nus.edu.sg Address: 444, delta street Tags: [friends] +|| =================================================== +|| Enter command: || [Command entered: list] +|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: +|| 2. Betsy Choo Tags: [secretive] +|| 3. Charlie Dickson Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] +|| 4. Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] +|| +|| 4 persons listed! +|| =================================================== +|| Enter command: || [Command entered: add Esther Potato p/555555 e/esther@not.a.real.potato pa/555, epsilon street t/tubers t/starchy] +|| New person added: Esther Potato Phone: 555555 Email: esther@not.a.real.potato Address: (private) 555, epsilon street Tags: [tubers][starchy] +|| =================================================== +|| Enter command: || [Command entered: list] +|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: +|| 2. Betsy Choo Tags: [secretive] +|| 3. Charlie Dickson Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] +|| 4. Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] +|| 5. Esther Potato Phone: 555555 Email: esther@not.a.real.potato Tags: [tubers][starchy] +|| +|| 5 persons listed! +|| =================================================== +|| Enter command: || [Command entered: add Esther Potato p/555555 e/esther@not.a.real.potato pa/555, epsilon street t/tubers t/starchy] +|| This person already exists in the address book +|| =================================================== +|| Enter command: || [Command entered: view] +|| Invalid command format! +|| view: Views the non-private details of the person identified by the index number in the last shown person listing. +|| Parameters: INDEX +|| Example: view 1 +|| =================================================== +|| Enter command: || [Command entered: viewall] +|| Invalid command format! +|| viewall: Views the non-private details of the person identified by the index number in the last shown person listing. +|| Parameters: INDEX +|| Example: viewall 1 +|| =================================================== +|| Enter command: || [Command entered: view should be only one number] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: viewall should only be one number] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: view -1] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: view 0] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: view 6] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: viewall -1] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: viewall 0] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: viewall 6] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: view 1] +|| Viewing person: Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: +|| =================================================== +|| Enter command: || [Command entered: viewall 1] +|| Viewing person: Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: +|| =================================================== +|| Enter command: || [Command entered: view 3] +|| Viewing person: Charlie Dickson Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] +|| =================================================== +|| Enter command: || [Command entered: view 4] +|| Viewing person: Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] +|| =================================================== +|| Enter command: || [Command entered: view 5] +|| Viewing person: Esther Potato Phone: 555555 Email: esther@not.a.real.potato Tags: [tubers][starchy] +|| =================================================== +|| Enter command: || [Command entered: viewall 3] +|| Viewing person: Charlie Dickson Phone: (private) 333333 Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] +|| =================================================== +|| Enter command: || [Command entered: viewall 4] +|| Viewing person: Dickson Ee Phone: 444444 Email: (private) dickson@nus.edu.sg Address: 444, delta street Tags: [friends] +|| =================================================== +|| Enter command: || [Command entered: viewall 5] +|| Viewing person: Esther Potato Phone: 555555 Email: esther@not.a.real.potato Address: (private) 555, epsilon street Tags: [tubers][starchy] +|| =================================================== +|| Enter command: || [Command entered: find] +|| Invalid command format! +|| find: Finds all persons whose names contain any of the specified keywords (case-sensitive) and displays them as a list with index numbers. +|| Parameters: KEYWORD [MORE_KEYWORDS]... +|| Example: find alice bob charlie +|| =================================================== +|| Enter command: || [Command entered: find bet] +|| +|| 0 persons listed! +|| =================================================== +|| Enter command: || [Command entered: find 23912039120] +|| +|| 0 persons listed! +|| =================================================== +|| Enter command: || [Command entered: find betsy] +|| +|| 0 persons listed! +|| =================================================== +|| Enter command: || [Command entered: find Betsy] +|| 1. Betsy Choo Tags: [secretive] +|| +|| 1 persons listed! +|| =================================================== +|| Enter command: || [Command entered: find Dickson] +|| 1. Charlie Dickson Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] +|| 2. Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] +|| +|| 2 persons listed! +|| =================================================== +|| Enter command: || [Command entered: find Charlie Betsy] +|| 1. Betsy Choo Tags: [secretive] +|| 2. Charlie Dickson Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] +|| +|| 2 persons listed! +|| =================================================== +|| Enter command: || [Command entered: delete] +|| Invalid command format! +|| delete: Deletes the person identified by the index number used in the last person listing. +|| Parameters: INDEX +|| Example: delete 1 +|| =================================================== +|| Enter command: || [Command entered: delete should be only one number] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: delete -1] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: delete 0] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: delete 3] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: delete 2] +|| Deleted Person: Charlie Dickson Phone: (private) 333333 Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] +|| =================================================== +|| Enter command: || [Command entered: delete 2] +|| Person could not be found in address book +|| =================================================== +|| Enter command: || [Command entered: view 2] +|| Person could not be found in address book +|| =================================================== +|| Enter command: || [Command entered: viewall 2] +|| Person could not be found in address book +|| =================================================== +|| Enter command: || [Command entered: list] +|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: +|| 2. Betsy Choo Tags: [secretive] +|| 3. Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] +|| 4. Esther Potato Phone: 555555 Email: esther@not.a.real.potato Tags: [tubers][starchy] +|| +|| 4 persons listed! +|| =================================================== +|| Enter command: || [Command entered: delete 4] +|| Deleted Person: Esther Potato Phone: 555555 Email: esther@not.a.real.potato Address: (private) 555, epsilon street Tags: [tubers][starchy] +|| =================================================== +|| Enter command: || [Command entered: list] +|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: +|| 2. Betsy Choo Tags: [secretive] +|| 3. Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] +|| +|| 3 persons listed! +|| =================================================== +|| Enter command: || [Command entered: delete 1] +|| Deleted Person: Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: +|| =================================================== +|| Enter command: || [Command entered: list] +|| 1. Betsy Choo Tags: [secretive] +|| 2. Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] +|| +|| 2 persons listed! +|| =================================================== +|| Enter command: || [Command entered: clear] +|| Address book has been cleared! +|| =================================================== +|| Enter command: || [Command entered: list] +|| +|| 0 persons listed! +|| =================================================== +|| Enter command: || [Command entered: exit] +|| Exiting Address Book as requested ... +|| =================================================== +|| Good bye! +|| =================================================== +|| =================================================== From 71cf24fbaa2f386533ac81740d3a34b320845a20 Mon Sep 17 00:00:00 2001 From: FongYuan <42345573+FongYuan@users.noreply.github.com> Date: Thu, 13 Sep 2018 20:51:38 +0800 Subject: [PATCH 8/9] Overload Command.getMessageUsage() to simplify declaration of commands that take in no parameters. --- src/seedu/addressbook/commands/ClearCommand.java | 4 +--- src/seedu/addressbook/commands/Command.java | 15 ++++++++++++++- src/seedu/addressbook/commands/ExitCommand.java | 6 ++---- src/seedu/addressbook/commands/HelpCommand.java | 4 +--- src/seedu/addressbook/commands/ListCommand.java | 4 +--- test/expected.txt | 8 ++++---- 6 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/seedu/addressbook/commands/ClearCommand.java b/src/seedu/addressbook/commands/ClearCommand.java index b3eefbae2..81b6b33aa 100644 --- a/src/seedu/addressbook/commands/ClearCommand.java +++ b/src/seedu/addressbook/commands/ClearCommand.java @@ -7,9 +7,7 @@ public class ClearCommand extends Command { public static final String COMMAND_WORD = "clear"; public static final String MESSAGE_USAGE = Command.getMessageUsage(COMMAND_WORD, - "Clears address book permanently.", - "none", - ""); + "Clears address book permanently."); public static final String MESSAGE_SUCCESS = "Address book has been cleared!"; diff --git a/src/seedu/addressbook/commands/Command.java b/src/seedu/addressbook/commands/Command.java index 826d309b4..acbbf7fb3 100644 --- a/src/seedu/addressbook/commands/Command.java +++ b/src/seedu/addressbook/commands/Command.java @@ -42,7 +42,20 @@ protected static String getMessageUsage( return commandWord + ": " + commandDesc + "\n" + " Parameters: " + commandParams + "\n" - + " Example: " + commandWord + " " + commandEgParams; + + " Example: " + commandWord + (commandEgParams.equals("") ? "" : " " + commandEgParams); + } + + /** + * Overloaded getMessageUsage() for commands that take in no parameters + * @param commandWord The command's COMMAND_WORD + * @param commandDesc A brief description of what the command does + * @return the MESSAGE_USAGE for a command. + */ + protected static String getMessageUsage( + String commandWord, + String commandDesc) { + + return getMessageUsage(commandWord, commandDesc, "none", ""); } /** diff --git a/src/seedu/addressbook/commands/ExitCommand.java b/src/seedu/addressbook/commands/ExitCommand.java index 7ef76a32f..816644bd6 100644 --- a/src/seedu/addressbook/commands/ExitCommand.java +++ b/src/seedu/addressbook/commands/ExitCommand.java @@ -8,10 +8,8 @@ public class ExitCommand extends Command { public static final String COMMAND_WORD = "exit"; public static final String MESSAGE_USAGE = Command.getMessageUsage(COMMAND_WORD, - "Exits the program.", - "none", - ""); - + "Exits the program."); + public static final String MESSAGE_EXIT_ACKNOWEDGEMENT = "Exiting Address Book as requested ..."; @Override diff --git a/src/seedu/addressbook/commands/HelpCommand.java b/src/seedu/addressbook/commands/HelpCommand.java index 07730f994..5d09748cf 100644 --- a/src/seedu/addressbook/commands/HelpCommand.java +++ b/src/seedu/addressbook/commands/HelpCommand.java @@ -9,9 +9,7 @@ public class HelpCommand extends Command { public static final String COMMAND_WORD = "help"; public static final String MESSAGE_USAGE = Command.getMessageUsage(COMMAND_WORD, - "Shows program usage instructions.", - "none", - ""); + "Shows program usage instructions."); @Override public CommandResult execute() { diff --git a/src/seedu/addressbook/commands/ListCommand.java b/src/seedu/addressbook/commands/ListCommand.java index ae75aba66..ccc04797f 100644 --- a/src/seedu/addressbook/commands/ListCommand.java +++ b/src/seedu/addressbook/commands/ListCommand.java @@ -13,9 +13,7 @@ public class ListCommand extends Command { public static final String COMMAND_WORD = "list"; public static final String MESSAGE_USAGE = Command.getMessageUsage(COMMAND_WORD, - "Displays all persons in the address book as a list with index numbers.", - "none", - ""); + "Displays all persons in the address book as a list with index numbers."); @Override diff --git a/test/expected.txt b/test/expected.txt index 3f7540bd5..6a4438564 100644 --- a/test/expected.txt +++ b/test/expected.txt @@ -14,13 +14,13 @@ || Example: delete 1 || clear: Clears address book permanently. || Parameters: none -|| Example: clear +|| Example: clear || find: Finds all persons whose names contain any of the specified keywords (case-sensitive) and displays them as a list with index numbers. || Parameters: KEYWORD [MORE_KEYWORDS]... || Example: find alice bob charlie || list: Displays all persons in the address book as a list with index numbers. || Parameters: none -|| Example: list +|| Example: list || view: Views the non-private details of the person identified by the index number in the last shown person listing. || Parameters: INDEX || Example: view 1 @@ -29,10 +29,10 @@ || Example: viewall 1 || help: Shows program usage instructions. || Parameters: none -|| Example: help +|| Example: help || exit: Exits the program. || Parameters: none -|| Example: exit +|| Example: exit || =================================================== || Enter command: || [Command entered: delete 1] || The person index provided is invalid From 0daf6643231b0530eaeeb28884dab5d570ba2b51 Mon Sep 17 00:00:00 2001 From: FongYuan <42345573+FongYuan@users.noreply.github.com> Date: Fri, 14 Sep 2018 11:19:53 +0800 Subject: [PATCH 9/9] Update test/expected.txt --- test/expected.txt | 618 +++++++++++++++++++++++----------------------- 1 file changed, 309 insertions(+), 309 deletions(-) diff --git a/test/expected.txt b/test/expected.txt index 6a4438564..99d659b1e 100644 --- a/test/expected.txt +++ b/test/expected.txt @@ -1,309 +1,309 @@ -|| =================================================== -|| =================================================== -|| Welcome to your Address Book! -|| AddressBook Level 2 - Version 1.0 -|| Launch command format: java seedu.addressbook.Main [STORAGE_FILE_PATH] -|| Using storage file : addressbook.txt -|| =================================================== -|| Enter command: || [Command entered: sfdfd] -|| add: Adds a person to the address book. Contact details can be marked private by prepending 'p' to the prefix. -|| Parameters: NAME [p]p/PHONE [p]e/EMAIL [p]a/ADDRESS [t/TAG]... -|| Example: add John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney -|| delete: Deletes the person identified by the index number used in the last person listing. -|| Parameters: INDEX -|| Example: delete 1 -|| clear: Clears address book permanently. -|| Parameters: none -|| Example: clear -|| find: Finds all persons whose names contain any of the specified keywords (case-sensitive) and displays them as a list with index numbers. -|| Parameters: KEYWORD [MORE_KEYWORDS]... -|| Example: find alice bob charlie -|| list: Displays all persons in the address book as a list with index numbers. -|| Parameters: none -|| Example: list -|| view: Views the non-private details of the person identified by the index number in the last shown person listing. -|| Parameters: INDEX -|| Example: view 1 -|| viewall: Views the non-private details of the person identified by the index number in the last shown person listing. -|| Parameters: INDEX -|| Example: viewall 1 -|| help: Shows program usage instructions. -|| Parameters: none -|| Example: help -|| exit: Exits the program. -|| Parameters: none -|| Example: exit -|| =================================================== -|| Enter command: || [Command entered: delete 1] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: view 1] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: viewall 1] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: clear] -|| Address book has been cleared! -|| =================================================== -|| Enter command: || [Command entered: list] -|| -|| 0 persons listed! -|| =================================================== -|| Enter command: || [Command entered: add wrong args wrong args] -|| Invalid command format! -|| add: Adds a person to the address book. Contact details can be marked private by prepending 'p' to the prefix. -|| Parameters: NAME [p]p/PHONE [p]e/EMAIL [p]a/ADDRESS [t/TAG]... -|| Example: add John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney -|| =================================================== -|| Enter command: || [Command entered: add Valid Name 12345 e/valid@email.butNoPhonePrefix a/valid, address] -|| Invalid command format! -|| add: Adds a person to the address book. Contact details can be marked private by prepending 'p' to the prefix. -|| Parameters: NAME [p]p/PHONE [p]e/EMAIL [p]a/ADDRESS [t/TAG]... -|| Example: add John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney -|| =================================================== -|| Enter command: || [Command entered: add Valid Name p/12345 valid@email.butNoPrefix a/valid, address] -|| Invalid command format! -|| add: Adds a person to the address book. Contact details can be marked private by prepending 'p' to the prefix. -|| Parameters: NAME [p]p/PHONE [p]e/EMAIL [p]a/ADDRESS [t/TAG]... -|| Example: add John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney -|| =================================================== -|| Enter command: || [Command entered: add Valid Name p/12345 e/valid@email.butNoAddressPrefix valid, address] -|| Invalid command format! -|| add: Adds a person to the address book. Contact details can be marked private by prepending 'p' to the prefix. -|| Parameters: NAME [p]p/PHONE [p]e/EMAIL [p]a/ADDRESS [t/TAG]... -|| Example: add John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney -|| =================================================== -|| Enter command: || [Command entered: add Valid Name p/12345 e/valid@email.butNoTagPrefix a/valid, address t/goodTag noPrefixTag] -|| Tags names should be alphanumeric -|| =================================================== -|| Enter command: || [Command entered: add []\[;] p/12345 e/valid@e.mail a/valid, address] -|| Person names should be spaces or alphabetic characters -|| =================================================== -|| Enter command: || [Command entered: add Valid Name p/not_numbers e/valid@e.mail a/valid, address] -|| Person phone numbers should only contain numbers -|| =================================================== -|| Enter command: || [Command entered: add Valid Name p/12345 e/notAnEmail a/valid, address] -|| Person emails should be 2 alphanumeric/period strings separated by '@' -|| =================================================== -|| Enter command: || [Command entered: add Valid Name p/12345 e/valid@e.mail a/valid, address t/invalid_-[.tag] -|| Tags names should be alphanumeric -|| =================================================== -|| Enter command: || [Command entered: add Adam Brown p/111111 e/adam@gmail.com a/111, alpha street] -|| New person added: Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: -|| =================================================== -|| Enter command: || [Command entered: list] -|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: -|| -|| 1 persons listed! -|| =================================================== -|| Enter command: || [Command entered: add Betsy Choo pp/222222 pe/benchoo@nus.edu.sg pa/222, beta street t/secretive] -|| New person added: Betsy Choo Phone: (private) 222222 Email: (private) benchoo@nus.edu.sg Address: (private) 222, beta street Tags: [secretive] -|| =================================================== -|| Enter command: || [Command entered: list] -|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: -|| 2. Betsy Choo Tags: [secretive] -|| -|| 2 persons listed! -|| =================================================== -|| Enter command: || [Command entered: add Charlie Dickson pp/333333 e/charlie.d@nus.edu.sg a/333, gamma street t/friends t/school] -|| New person added: Charlie Dickson Phone: (private) 333333 Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] -|| =================================================== -|| Enter command: || [Command entered: list] -|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: -|| 2. Betsy Choo Tags: [secretive] -|| 3. Charlie Dickson Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] -|| -|| 3 persons listed! -|| =================================================== -|| Enter command: || [Command entered: add Dickson Ee p/444444 pe/dickson@nus.edu.sg a/444, delta street t/friends] -|| New person added: Dickson Ee Phone: 444444 Email: (private) dickson@nus.edu.sg Address: 444, delta street Tags: [friends] -|| =================================================== -|| Enter command: || [Command entered: list] -|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: -|| 2. Betsy Choo Tags: [secretive] -|| 3. Charlie Dickson Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] -|| 4. Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] -|| -|| 4 persons listed! -|| =================================================== -|| Enter command: || [Command entered: add Esther Potato p/555555 e/esther@not.a.real.potato pa/555, epsilon street t/tubers t/starchy] -|| New person added: Esther Potato Phone: 555555 Email: esther@not.a.real.potato Address: (private) 555, epsilon street Tags: [tubers][starchy] -|| =================================================== -|| Enter command: || [Command entered: list] -|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: -|| 2. Betsy Choo Tags: [secretive] -|| 3. Charlie Dickson Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] -|| 4. Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] -|| 5. Esther Potato Phone: 555555 Email: esther@not.a.real.potato Tags: [tubers][starchy] -|| -|| 5 persons listed! -|| =================================================== -|| Enter command: || [Command entered: add Esther Potato p/555555 e/esther@not.a.real.potato pa/555, epsilon street t/tubers t/starchy] -|| This person already exists in the address book -|| =================================================== -|| Enter command: || [Command entered: view] -|| Invalid command format! -|| view: Views the non-private details of the person identified by the index number in the last shown person listing. -|| Parameters: INDEX -|| Example: view 1 -|| =================================================== -|| Enter command: || [Command entered: viewall] -|| Invalid command format! -|| viewall: Views the non-private details of the person identified by the index number in the last shown person listing. -|| Parameters: INDEX -|| Example: viewall 1 -|| =================================================== -|| Enter command: || [Command entered: view should be only one number] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: viewall should only be one number] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: view -1] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: view 0] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: view 6] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: viewall -1] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: viewall 0] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: viewall 6] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: view 1] -|| Viewing person: Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: -|| =================================================== -|| Enter command: || [Command entered: viewall 1] -|| Viewing person: Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: -|| =================================================== -|| Enter command: || [Command entered: view 3] -|| Viewing person: Charlie Dickson Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] -|| =================================================== -|| Enter command: || [Command entered: view 4] -|| Viewing person: Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] -|| =================================================== -|| Enter command: || [Command entered: view 5] -|| Viewing person: Esther Potato Phone: 555555 Email: esther@not.a.real.potato Tags: [tubers][starchy] -|| =================================================== -|| Enter command: || [Command entered: viewall 3] -|| Viewing person: Charlie Dickson Phone: (private) 333333 Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] -|| =================================================== -|| Enter command: || [Command entered: viewall 4] -|| Viewing person: Dickson Ee Phone: 444444 Email: (private) dickson@nus.edu.sg Address: 444, delta street Tags: [friends] -|| =================================================== -|| Enter command: || [Command entered: viewall 5] -|| Viewing person: Esther Potato Phone: 555555 Email: esther@not.a.real.potato Address: (private) 555, epsilon street Tags: [tubers][starchy] -|| =================================================== -|| Enter command: || [Command entered: find] -|| Invalid command format! -|| find: Finds all persons whose names contain any of the specified keywords (case-sensitive) and displays them as a list with index numbers. -|| Parameters: KEYWORD [MORE_KEYWORDS]... -|| Example: find alice bob charlie -|| =================================================== -|| Enter command: || [Command entered: find bet] -|| -|| 0 persons listed! -|| =================================================== -|| Enter command: || [Command entered: find 23912039120] -|| -|| 0 persons listed! -|| =================================================== -|| Enter command: || [Command entered: find betsy] -|| -|| 0 persons listed! -|| =================================================== -|| Enter command: || [Command entered: find Betsy] -|| 1. Betsy Choo Tags: [secretive] -|| -|| 1 persons listed! -|| =================================================== -|| Enter command: || [Command entered: find Dickson] -|| 1. Charlie Dickson Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] -|| 2. Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] -|| -|| 2 persons listed! -|| =================================================== -|| Enter command: || [Command entered: find Charlie Betsy] -|| 1. Betsy Choo Tags: [secretive] -|| 2. Charlie Dickson Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] -|| -|| 2 persons listed! -|| =================================================== -|| Enter command: || [Command entered: delete] -|| Invalid command format! -|| delete: Deletes the person identified by the index number used in the last person listing. -|| Parameters: INDEX -|| Example: delete 1 -|| =================================================== -|| Enter command: || [Command entered: delete should be only one number] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: delete -1] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: delete 0] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: delete 3] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: delete 2] -|| Deleted Person: Charlie Dickson Phone: (private) 333333 Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] -|| =================================================== -|| Enter command: || [Command entered: delete 2] -|| Person could not be found in address book -|| =================================================== -|| Enter command: || [Command entered: view 2] -|| Person could not be found in address book -|| =================================================== -|| Enter command: || [Command entered: viewall 2] -|| Person could not be found in address book -|| =================================================== -|| Enter command: || [Command entered: list] -|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: -|| 2. Betsy Choo Tags: [secretive] -|| 3. Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] -|| 4. Esther Potato Phone: 555555 Email: esther@not.a.real.potato Tags: [tubers][starchy] -|| -|| 4 persons listed! -|| =================================================== -|| Enter command: || [Command entered: delete 4] -|| Deleted Person: Esther Potato Phone: 555555 Email: esther@not.a.real.potato Address: (private) 555, epsilon street Tags: [tubers][starchy] -|| =================================================== -|| Enter command: || [Command entered: list] -|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: -|| 2. Betsy Choo Tags: [secretive] -|| 3. Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] -|| -|| 3 persons listed! -|| =================================================== -|| Enter command: || [Command entered: delete 1] -|| Deleted Person: Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: -|| =================================================== -|| Enter command: || [Command entered: list] -|| 1. Betsy Choo Tags: [secretive] -|| 2. Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] -|| -|| 2 persons listed! -|| =================================================== -|| Enter command: || [Command entered: clear] -|| Address book has been cleared! -|| =================================================== -|| Enter command: || [Command entered: list] -|| -|| 0 persons listed! -|| =================================================== -|| Enter command: || [Command entered: exit] -|| Exiting Address Book as requested ... -|| =================================================== -|| Good bye! -|| =================================================== -|| =================================================== +|| =================================================== +|| =================================================== +|| Welcome to your Address Book! +|| AddressBook Level 2 - Version 1.0 +|| Launch command format: java seedu.addressbook.Main [STORAGE_FILE_PATH] +|| Using storage file : addressbook.txt +|| =================================================== +|| Enter command: || [Command entered: sfdfd] +|| add: Adds a person to the address book. Contact details can be marked private by prepending 'p' to the prefix. +|| Parameters: NAME [p]p/PHONE [p]e/EMAIL [p]a/ADDRESS [t/TAG]... +|| Example: add John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney +|| delete: Deletes the person identified by the index number used in the last person listing. +|| Parameters: INDEX +|| Example: delete 1 +|| clear: Clears address book permanently. +|| Parameters: none +|| Example: clear +|| find: Finds all persons whose names contain any of the specified keywords (case-sensitive) and displays them as a list with index numbers. +|| Parameters: KEYWORD [MORE_KEYWORDS]... +|| Example: find alice bob charlie +|| list: Displays all persons in the address book as a list with index numbers. +|| Parameters: none +|| Example: list +|| view: Views the non-private details of the person identified by the index number in the last shown person listing. +|| Parameters: INDEX +|| Example: view 1 +|| viewall: Views the non-private details of the person identified by the index number in the last shown person listing. +|| Parameters: INDEX +|| Example: viewall 1 +|| help: Shows program usage instructions. +|| Parameters: none +|| Example: help +|| exit: Exits the program. +|| Parameters: none +|| Example: exit +|| =================================================== +|| Enter command: || [Command entered: delete 1] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: view 1] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: viewall 1] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: clear] +|| Address book has been cleared! +|| =================================================== +|| Enter command: || [Command entered: list] +|| +|| 0 persons listed! +|| =================================================== +|| Enter command: || [Command entered: add wrong args wrong args] +|| Invalid command format! +|| add: Adds a person to the address book. Contact details can be marked private by prepending 'p' to the prefix. +|| Parameters: NAME [p]p/PHONE [p]e/EMAIL [p]a/ADDRESS [t/TAG]... +|| Example: add John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney +|| =================================================== +|| Enter command: || [Command entered: add Valid Name 12345 e/valid@email.butNoPhonePrefix a/valid, address] +|| Invalid command format! +|| add: Adds a person to the address book. Contact details can be marked private by prepending 'p' to the prefix. +|| Parameters: NAME [p]p/PHONE [p]e/EMAIL [p]a/ADDRESS [t/TAG]... +|| Example: add John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney +|| =================================================== +|| Enter command: || [Command entered: add Valid Name p/12345 valid@email.butNoPrefix a/valid, address] +|| Invalid command format! +|| add: Adds a person to the address book. Contact details can be marked private by prepending 'p' to the prefix. +|| Parameters: NAME [p]p/PHONE [p]e/EMAIL [p]a/ADDRESS [t/TAG]... +|| Example: add John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney +|| =================================================== +|| Enter command: || [Command entered: add Valid Name p/12345 e/valid@email.butNoAddressPrefix valid, address] +|| Invalid command format! +|| add: Adds a person to the address book. Contact details can be marked private by prepending 'p' to the prefix. +|| Parameters: NAME [p]p/PHONE [p]e/EMAIL [p]a/ADDRESS [t/TAG]... +|| Example: add John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney +|| =================================================== +|| Enter command: || [Command entered: add Valid Name p/12345 e/valid@email.butNoTagPrefix a/valid, address t/goodTag noPrefixTag] +|| Tags names should be alphanumeric +|| =================================================== +|| Enter command: || [Command entered: add []\[;] p/12345 e/valid@e.mail a/valid, address] +|| Person names should be spaces or alphabetic characters +|| =================================================== +|| Enter command: || [Command entered: add Valid Name p/not_numbers e/valid@e.mail a/valid, address] +|| Person phone numbers should only contain numbers +|| =================================================== +|| Enter command: || [Command entered: add Valid Name p/12345 e/notAnEmail a/valid, address] +|| Person emails should be 2 alphanumeric/period strings separated by '@' +|| =================================================== +|| Enter command: || [Command entered: add Valid Name p/12345 e/valid@e.mail a/valid, address t/invalid_-[.tag] +|| Tags names should be alphanumeric +|| =================================================== +|| Enter command: || [Command entered: add Adam Brown p/111111 e/adam@gmail.com a/111, alpha street] +|| New person added: Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: +|| =================================================== +|| Enter command: || [Command entered: list] +|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: +|| +|| 1 persons listed! +|| =================================================== +|| Enter command: || [Command entered: add Betsy Choo pp/222222 pe/benchoo@nus.edu.sg pa/222, beta street t/secretive] +|| New person added: Betsy Choo Phone: (private) 222222 Email: (private) benchoo@nus.edu.sg Address: (private) 222, beta street Tags: [secretive] +|| =================================================== +|| Enter command: || [Command entered: list] +|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: +|| 2. Betsy Choo Tags: [secretive] +|| +|| 2 persons listed! +|| =================================================== +|| Enter command: || [Command entered: add Charlie Dickson pp/333333 e/charlie.d@nus.edu.sg a/333, gamma street t/friends t/school] +|| New person added: Charlie Dickson Phone: (private) 333333 Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] +|| =================================================== +|| Enter command: || [Command entered: list] +|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: +|| 2. Betsy Choo Tags: [secretive] +|| 3. Charlie Dickson Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] +|| +|| 3 persons listed! +|| =================================================== +|| Enter command: || [Command entered: add Dickson Ee p/444444 pe/dickson@nus.edu.sg a/444, delta street t/friends] +|| New person added: Dickson Ee Phone: 444444 Email: (private) dickson@nus.edu.sg Address: 444, delta street Tags: [friends] +|| =================================================== +|| Enter command: || [Command entered: list] +|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: +|| 2. Betsy Choo Tags: [secretive] +|| 3. Charlie Dickson Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] +|| 4. Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] +|| +|| 4 persons listed! +|| =================================================== +|| Enter command: || [Command entered: add Esther Potato p/555555 e/esther@not.a.real.potato pa/555, epsilon street t/tubers t/starchy] +|| New person added: Esther Potato Phone: 555555 Email: esther@not.a.real.potato Address: (private) 555, epsilon street Tags: [tubers][starchy] +|| =================================================== +|| Enter command: || [Command entered: list] +|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: +|| 2. Betsy Choo Tags: [secretive] +|| 3. Charlie Dickson Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] +|| 4. Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] +|| 5. Esther Potato Phone: 555555 Email: esther@not.a.real.potato Tags: [tubers][starchy] +|| +|| 5 persons listed! +|| =================================================== +|| Enter command: || [Command entered: add Esther Potato p/555555 e/esther@not.a.real.potato pa/555, epsilon street t/tubers t/starchy] +|| This person already exists in the address book +|| =================================================== +|| Enter command: || [Command entered: view] +|| Invalid command format! +|| view: Views the non-private details of the person identified by the index number in the last shown person listing. +|| Parameters: INDEX +|| Example: view 1 +|| =================================================== +|| Enter command: || [Command entered: viewall] +|| Invalid command format! +|| viewall: Views the non-private details of the person identified by the index number in the last shown person listing. +|| Parameters: INDEX +|| Example: viewall 1 +|| =================================================== +|| Enter command: || [Command entered: view should be only one number] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: viewall should only be one number] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: view -1] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: view 0] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: view 6] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: viewall -1] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: viewall 0] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: viewall 6] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: view 1] +|| Viewing person: Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: +|| =================================================== +|| Enter command: || [Command entered: viewall 1] +|| Viewing person: Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: +|| =================================================== +|| Enter command: || [Command entered: view 3] +|| Viewing person: Charlie Dickson Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] +|| =================================================== +|| Enter command: || [Command entered: view 4] +|| Viewing person: Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] +|| =================================================== +|| Enter command: || [Command entered: view 5] +|| Viewing person: Esther Potato Phone: 555555 Email: esther@not.a.real.potato Tags: [tubers][starchy] +|| =================================================== +|| Enter command: || [Command entered: viewall 3] +|| Viewing person: Charlie Dickson Phone: (private) 333333 Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] +|| =================================================== +|| Enter command: || [Command entered: viewall 4] +|| Viewing person: Dickson Ee Phone: 444444 Email: (private) dickson@nus.edu.sg Address: 444, delta street Tags: [friends] +|| =================================================== +|| Enter command: || [Command entered: viewall 5] +|| Viewing person: Esther Potato Phone: 555555 Email: esther@not.a.real.potato Address: (private) 555, epsilon street Tags: [tubers][starchy] +|| =================================================== +|| Enter command: || [Command entered: find] +|| Invalid command format! +|| find: Finds all persons whose names contain any of the specified keywords (case-sensitive) and displays them as a list with index numbers. +|| Parameters: KEYWORD [MORE_KEYWORDS]... +|| Example: find alice bob charlie +|| =================================================== +|| Enter command: || [Command entered: find bet] +|| +|| 0 persons listed! +|| =================================================== +|| Enter command: || [Command entered: find 23912039120] +|| +|| 0 persons listed! +|| =================================================== +|| Enter command: || [Command entered: find betsy] +|| +|| 0 persons listed! +|| =================================================== +|| Enter command: || [Command entered: find Betsy] +|| 1. Betsy Choo Tags: [secretive] +|| +|| 1 persons listed! +|| =================================================== +|| Enter command: || [Command entered: find Dickson] +|| 1. Charlie Dickson Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] +|| 2. Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] +|| +|| 2 persons listed! +|| =================================================== +|| Enter command: || [Command entered: find Charlie Betsy] +|| 1. Betsy Choo Tags: [secretive] +|| 2. Charlie Dickson Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] +|| +|| 2 persons listed! +|| =================================================== +|| Enter command: || [Command entered: delete] +|| Invalid command format! +|| delete: Deletes the person identified by the index number used in the last person listing. +|| Parameters: INDEX +|| Example: delete 1 +|| =================================================== +|| Enter command: || [Command entered: delete should be only one number] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: delete -1] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: delete 0] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: delete 3] +|| The person index provided is invalid +|| =================================================== +|| Enter command: || [Command entered: delete 2] +|| Deleted Person: Charlie Dickson Phone: (private) 333333 Email: charlie.d@nus.edu.sg Address: 333, gamma street Tags: [school][friends] +|| =================================================== +|| Enter command: || [Command entered: delete 2] +|| Person could not be found in address book +|| =================================================== +|| Enter command: || [Command entered: view 2] +|| Person could not be found in address book +|| =================================================== +|| Enter command: || [Command entered: viewall 2] +|| Person could not be found in address book +|| =================================================== +|| Enter command: || [Command entered: list] +|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: +|| 2. Betsy Choo Tags: [secretive] +|| 3. Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] +|| 4. Esther Potato Phone: 555555 Email: esther@not.a.real.potato Tags: [tubers][starchy] +|| +|| 4 persons listed! +|| =================================================== +|| Enter command: || [Command entered: delete 4] +|| Deleted Person: Esther Potato Phone: 555555 Email: esther@not.a.real.potato Address: (private) 555, epsilon street Tags: [tubers][starchy] +|| =================================================== +|| Enter command: || [Command entered: list] +|| 1. Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: +|| 2. Betsy Choo Tags: [secretive] +|| 3. Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] +|| +|| 3 persons listed! +|| =================================================== +|| Enter command: || [Command entered: delete 1] +|| Deleted Person: Adam Brown Phone: 111111 Email: adam@gmail.com Address: 111, alpha street Tags: +|| =================================================== +|| Enter command: || [Command entered: list] +|| 1. Betsy Choo Tags: [secretive] +|| 2. Dickson Ee Phone: 444444 Address: 444, delta street Tags: [friends] +|| +|| 2 persons listed! +|| =================================================== +|| Enter command: || [Command entered: clear] +|| Address book has been cleared! +|| =================================================== +|| Enter command: || [Command entered: list] +|| +|| 0 persons listed! +|| =================================================== +|| Enter command: || [Command entered: exit] +|| Exiting Address Book as requested ... +|| =================================================== +|| Good bye! +|| =================================================== +|| ===================================================