package seedu.bulletjournal.logic.parser;

/**
 * Provides variations of commands Note: hard-coded for v0.2, will implement nlp
 * for future versions
 * @author Tu An - arishuynhvan
 */

public class FlexibleCommand {
    private String commandFromUser = "";
    private String[] commandGroups = new String[] { "add a adds create creates new", "clear clr c clears empty empties",
        "delete d deletes del remove removes rm", "edit edits e change changes",
        "exit exits close closes logout logouts", "find finds f search searches lookup",
        "help helps h manual instruction instructions", "list lists l ls show shows display displays showall",
        "select selects s choose chooses" };

    /**
     * Constructor must take in a valid string input
     * @param cfu
     */
    public FlexibleCommand(String cfu) {
        commandFromUser = cfu;
    }

    /**
     * @return the correct command string that matches COMMAND_WORD of command
     *         classes
     */
    public String getCommandWord() {
        for (String commandGroup : commandGroups) {
            for (String command : commandGroup.split(" ")) {
                if (commandFromUser.equals(command)) {
                    return commandGroup.split(" ")[0];
                }
            }
        }
        return commandFromUser;
    }

    public boolean isValidCommand() {
        for (String commandGroup : commandGroups) {
            for (String command : commandGroup.split(" ")) {
                if (commandFromUser.equals(command))
                    return true;
            }
        }
        return false;
    }
}

@@ -1529,16 +1529,18 @@
 ommand))
+ %7B
 %0A       
@@ -1565,16 +1565,34 @@
 n true;%0A
+                %7D%0A
         

Fix style issues