From 00bdbb8606324178578be7b5ef64e67ef8be39cf Mon Sep 17 00:00:00 2001 From: NicLJR Date: Sat, 11 Feb 2023 17:52:20 +0800 Subject: [PATCH] Duke Level-9: Making Find more specific --- src/main/java/duke/command/FindCommand.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/duke/command/FindCommand.java b/src/main/java/duke/command/FindCommand.java index 74b6eb93c5..9aa325bdfa 100644 --- a/src/main/java/duke/command/FindCommand.java +++ b/src/main/java/duke/command/FindCommand.java @@ -10,7 +10,16 @@ public class FindCommand extends Command { public FindCommand(String textCmd) { super(textCmd); } - + + /** + * Produces a String for the GUI to read from. + * The String is the list of Tasks that contain that specific given keyword + * + * @param ui User Interface of Duke. + * @param storage storage of Duke. + * @param taskList task list containing all the tasks Duke is tracking. + * @return the String of all the tasks that contains the keyword. + */ @Override public String execute(Ui ui, Storage storage, TaskList taskList) throws DukeException { String[] commandSplit = textCmd.split(" "); @@ -22,7 +31,8 @@ public String execute(Ui ui, Storage storage, TaskList taskList) throws DukeExce } if (commandSplit.length == 1) { - throw new DukeException("The keyword for your Find Command cannot be blank!\n"); + throw new DukeException("The keyword for your Find Command cannot be blank!\n" + + "Please follow this format: find {keyword}"); } String keyWord = textCmd.substring(5);