Skip to content

Commit

Permalink
Make find command more dynamic
Browse files Browse the repository at this point in the history
Find command can only search by a single keyword.

Making find command more dynamic will allow better search function.

Let's
* Enable find command to search by multiple keywords.
  • Loading branch information
solomonng2001 committed Feb 22, 2024
1 parent 7f2e36b commit c785cf0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/seedu/banter/Parser.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package seedu.banter;

import java.time.LocalDateTime;
import java.util.Arrays;

import seedu.banter.enums.CommandType;
import seedu.banter.errors.BanterError;
Expand Down Expand Up @@ -200,8 +201,8 @@ private String parseFind(String input) throws InvalidBanterUsageError {
if (words.length == 1) {
throw Errors.MISSING_KEYWORD_ERROR;
}
String keyword = joinWords(words, 1, words.length - 1);
Card taskFoundMessage = new Card(taskList.findTasks(keyword));
String[] keywords = Arrays.copyOfRange(words, 1, words.length);
Card taskFoundMessage = new Card(taskList.findTasks(keywords));
return taskFoundMessage.getString();
}

Expand Down

0 comments on commit c785cf0

Please sign in to comment.