Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Make the find and list commands synonymous #42

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
public class ClearCommand extends Command {

public static final String COMMAND_WORD = "clear";
public static final String COMMAND_WORD = "reset";
public static final String MESSAGE_SUCCESS = "Address book has been cleared!";


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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 "
public static final String MESSAGE_USAGE = COMMAND_WORD + "/list: Finds all persons whose names contain any of "
+ "the specified keywords (case-insensitive) and displays them as a list with index numbers.\n"
+ "Parameters: KEYWORD [MORE_KEYWORDS]...\n"
+ "Example: " + COMMAND_WORD + " alice bob charlie";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ public Command parseCommand(String userInput) throws ParseException {
return new FindCommandParser().parse(arguments);

case ListCommand.COMMAND_WORD:
return new ListCommand();
if(arguments.isEmpty()){
return new ListCommand();
}
else {
return new FindCommandParser().parse(arguments);
}

case ExitCommand.COMMAND_WORD:
return new ExitCommand();
Expand Down
Loading