package seedu.emeraldo.logic.commands;


/**
 * Lists all tasks in Emeraldo to the user.
 */
//@@author A0139749L
public class ListCommand extends Command {

    public static final String COMMAND_WORD = "list";

    public static final String MESSAGE_LIST_ALL = "Listed all tasks";
    
    public static final String MESSAGE_LIST_UNCOMPLETED = "Listed all uncompleted tasks";
    
    public static final String MESSAGE_USAGE = COMMAND_WORD + ": Lists all uncompleted tasks\n"
            + COMMAND_WORD + " [KEYWORD]: Lists all tasks with tags containing the specified keyword (case-sensitive)"
            + "and displays them as a list with index numbers.\n"
            + "Example: " + COMMAND_WORD + " or " + COMMAND_WORD + " homework";

    private String keyword;
    private String successMessage;
    
    public ListCommand(String keyword){
        this.keyword = keyword;
    }
    
    @Override
    public CommandResult execute() {
        if(keyword.isEmpty()){
            model.updateFilteredListToShowUncompleted();
            this.successMessage = MESSAGE_LIST_UNCOMPLETED;
        }else if(keyword.equalsIgnoreCase("all")){
        	model.updateFilteredListToShowAll();
        	this.successMessage = MESSAGE_LIST_ALL;
        }else{
            model.updateFilteredTaskList(keyword);
            this.successMessage = getMessageForTaskListShownSummary(model.getFilteredTaskList().size());
        }
        return new CommandResult(successMessage);
    }
}

@@ -368,32 +368,137 @@
 ed tasks%22;%0A    %0A
+    public static final String MESSAGE_LIST_KEYWORD = %22Tasks with tag '%25s' successfully listed!%5Cn%22;%0A    %0A
     public stati
@@ -757,16 +757,17 @@
  numbers
+s
 .%5Cn%22%0A   
@@ -1439,16 +1439,91 @@
 essage =
+ String.format(MESSAGE_LIST_KEYWORD, keyword.toLowerCase())%0A            %09%09+
  getMess

change success message for listCommand