package seedu.ezdo.logic.parser;

import static seedu.ezdo.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;

import java.util.Optional;

import seedu.ezdo.logic.commands.Command;
import seedu.ezdo.logic.commands.IncorrectCommand;
import seedu.ezdo.logic.commands.KillCommand;

/**
 * Parses input arguments and creates a new KillCommand object
 */
public class KillCommandParser implements CommandParser {

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

        Optional<Integer> index = ParserUtil.parseIndex(args);
        if (!index.isPresent()) {
            return new IncorrectCommand(
                    String.format(MESSAGE_INVALID_COMMAND_FORMAT, KillCommand.MESSAGE_USAGE));
        }

        return new KillCommand(index.get());
    }

}

@@ -107,16 +107,44 @@
 ORMAT;%0A%0A
+import java.util.ArrayList;%0A
 import j
@@ -162,16 +162,16 @@
 tional;%0A
-
 %0Aimport 
@@ -645,25 +645,24 @@
 args) %7B%0A
-%0A
         
 Optional
@@ -653,24 +653,207 @@
         
-Optional
+if (args.isEmpty() %7C%7C args.trim().equals(%220%22)) %7B%0A            return new IncorrectCommand(String.format(MESSAGE_INVALID_COMMAND_FORMAT, KillCommand.MESSAGE_USAGE));%0A        %7D%0A        ArrayList
 %3CInteger
@@ -859,16 +859,18 @@
 r%3E index
+es
  = Parse
@@ -885,16 +885,18 @@
 rseIndex
+es
 (args);%0A
@@ -911,24 +911,23 @@
 if (
-!
 index
+es
 .is
-Present
+Empty
 ()) 
@@ -1115,14 +1115,10 @@
 ndex
-.get()
+es
 );%0A 

Update KillCommandParser to support killing multiple at once