package seedu.tasklist.logic.parser;

import static seedu.tasklist.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.tasklist.logic.parser.CliSyntax.KEYWORDS_ARGS_FORMAT;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Matcher;

import seedu.tasklist.logic.commands.Command;
import seedu.tasklist.logic.commands.IncorrectCommand;
import seedu.tasklist.logic.commands.SortCommand;

/**
 * Parses input arguments and creates a new SortCommand object
 */
public class SortCommandParser {

    /**
     * Parses the given {@code String} of arguments in the context of the SortCommand
     * and returns an SortCommand object for execution.
     */
    public Command parse(String args) {

        final Matcher matcher = KEYWORDS_ARGS_FORMAT.matcher(args.trim());
        if (!matcher.matches()) {
            return new IncorrectCommand(String.format(MESSAGE_INVALID_COMMAND_FORMAT, SortCommand.MESSAGE_USAGE));
        }
        
        final String[] keywords = matcher.group("keywords").split(" ");
        final Set<String> keyword = new HashSet<>(Arrays.asList(keywords));
        return new SortCommand(keyword);
    }


}


@@ -193,81 +193,8 @@
 T;%0A%0A
-import java.util.Arrays;%0Aimport java.util.HashSet;%0Aimport java.util.Set;%0A
 impo
@@ -916,17 +916,8 @@
   %7D%0A
-        %0A
     
@@ -936,18 +936,16 @@
 ring
-%5B%5D
  keyword
 s = 
@@ -940,17 +940,16 @@
  keyword
-s
  = match
@@ -972,95 +972,8 @@
 ds%22)
-.split(%22 %22);%0A        final Set%3CString%3E keyword = new HashSet%3C%3E(Arrays.asList(keywords))
 ;%0A  

Revert "Update SortCommandParser.java"