@@ -0,0 +1,2429 @@
+package seedu.taskmanager.logic.commands;%0A%0Aimport java.io.IOException;%0Aimport java.util.Optional;%0A%0Aimport seedu.taskmanager.commons.core.Config;%0Aimport seedu.taskmanager.commons.exceptions.DataConversionException;%0Aimport seedu.taskmanager.commons.util.ConfigUtil;%0Aimport seedu.taskmanager.commons.util.StringUtil;%0Aimport seedu.taskmanager.logic.commands.exceptions.CommandException;%0A%0A/**%0A * @@author A0114269E%0A * Move the directory of taskmanager.xml file to user-specified path to allow cloud service sync.%0A * Overwrite the given file path if a file with same name exists. Old XML file is not deleted.%0A * Path matching is case sensitive.%0A */%0Apublic class MoveCommand extends Command %7B%0A    public static final String COMMAND_WORD = %22mv%22;%0A    %0A    public static final String MESSAGE_USAGE = COMMAND_WORD + %22: Move the directory of the taskmanager.%22%0A            + %22xml file to allow user to sync with cloud services. Overwrite will occur for same file name.%5Cn%22%0A            + %22Parameters: PATH...%5Cn%22%0A            + %22Example: %22 + COMMAND_WORD + %22 /User/admin/Documents/taskmanager.xml%22;%0A    %0A    public static final String MESSAGE_SUCCESS = %22TaskManager directory moved to : %22;%0A    public static final String MESSAGE_ERROR_BUILDCONFIG = %22Failed to build new config%22;%0A    public static final String MESSAGE_ERROR_SAVECONFIG = %22Failed to save config file : '%251$s'%22;%0A    %0A    private final String newPath;%0A    %0A    public MoveCommand(String path) %7B%0A        this.newPath = path;%0A    %7D%0A    %0A    @Override%0A    public CommandResult execute() throws CommandException %7B%0A        Config newConfig;%0A        String configFilePathUsed;%0A        %0A        configFilePathUsed = Config.DEFAULT_CONFIG_FILE;%0A        %0A        try %7B%0A            Optional%3CConfig%3E configOptional = ConfigUtil.readConfig(configFilePathUsed);%0A            newConfig = configOptional.orElse(new Config());%0A        %7D catch (DataConversionException e) %7B%0A            throw new CommandException(MESSAGE_ERROR_BUILDCONFIG);%0A        %7D%0A        %0A        newConfig.setTaskManagerFilePath(this.newPath);%0A        storage.updateTaskManagerStorageDirectory(this.newPath, newConfig);%0A        %0A        try %7B%0A            ConfigUtil.saveConfig(newConfig, configFilePathUsed);%0A        %7D catch (IOException e) %7B%0A            throw new CommandException(MESSAGE_ERROR_SAVECONFIG + StringUtil.getDetails(e));%0A        %7D%0A        %0A        return new CommandResult(MESSAGE_SUCCESS + this.newPath);%0A    %7D%0A%7D%0A

Add new move command, a variant of change directory that overwrites given file path