Skip to content

Commit

Permalink
Merge pull request #228 from lennoxtr/master
Browse files Browse the repository at this point in the history
Modify export and import to standardize MESSAGE_USAGE
  • Loading branch information
hingen authored Mar 31, 2023
2 parents 4cf71af + 3f4ac10 commit 82b3066
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 15 deletions.
3 changes: 2 additions & 1 deletion src/main/java/seedu/address/commons/core/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public class Messages {
public static final String MESSAGE_EMPTY_MODULE = "No module is provided";
public static final String MESSAGE_ARCHIVE_FILE_ALREADY_EXIST = "File already exist. If you want to "
+ "overwrite this file, insert /overwrite true in the command";
public static final String MESSAGE_FILE_DOES_NOT_EXIST = "File does not exist";
public static final String MESSAGE_FILE_DOES_NOT_EXIST = "Either the file does not exist, or it was corrupted/ of"
+ " a wrong format";
public static final String MESSAGE_MODULE_ALREADY_EXIST_IN_TRACKER = "%1$s already exist in tracker. If you want "
+ "to overwrite data in this module, insert /overwrite true in the command";
public static final String MESSAGE_MODULE_DOES_NOT_EXIST_IN_ARCHIVE = "%1$s not found in this file";
Expand Down
16 changes: 9 additions & 7 deletions src/main/java/seedu/address/logic/commands/ExportCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@

public class ExportCommand extends Command {
public static final String COMMAND_WORD = "export";
public static final String MESSAGE_USAGE = COMMAND_WORD + ": archive all modules currently in Le Tracker " + "\n"
+ "\n"
+ "*** Command Format *** " + "\n"
+ COMMAND_WORD + " {file_name}" + "\n"
+ "\n"
+ "*** Example *** " + "\n"
+ COMMAND_WORD + " EG2310";
public static final String MESSAGE_USAGE = "\n" + COMMAND_WORD + ":\n"
+ "(1) Archive all modules currently in Le Tracker to a new file. File must be of JSON format\n"
+ "Parameter: "
+ "{file_name}\n"
+ "Example: " + COMMAND_WORD + " hello.json\n\n"
+ "(2) Archive all modules currently in Le Tracker to an existing file.\n"
+ "Parameter: "
+ "{file_name}\n"
+ "Example: " + COMMAND_WORD + " hello.json /overwrite true \n\n";
public static final String MESSAGE_SUCCESS = "All modules archived to %1$s";

private final String fileName;
Expand Down
24 changes: 17 additions & 7 deletions src/main/java/seedu/address/logic/commands/ImportCommand.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package seedu.address.logic.commands;

import static java.util.Objects.requireNonNull;
import static seedu.address.logic.parser.CliSyntax.PREFIX_MODULE;

import java.nio.file.Path;
import java.nio.file.Paths;
Expand All @@ -20,13 +21,22 @@ public class ImportCommand extends Command {
public static final String COMMAND_WORD = "import";
//TODO: CHANGE THIS

public static final String MESSAGE_USAGE = COMMAND_WORD + ": import specified modules in archive file" + "\n"
+ "\n"
+ "*** Command Format *** " + "\n"
+ COMMAND_WORD + " {file_name}" + "\n"
+ "\n"
+ "*** Example *** " + "\n"
+ COMMAND_WORD + " EG2310";
public static final String MESSAGE_USAGE = "\n" + COMMAND_WORD + ":\n"
+ "(1) Import all modules in archive file\n"
+ "Parameter: "
+ "{file_name}\n"
+ "Example: " + COMMAND_WORD + " hello.json\n\n"
+ "(2) Import specific modules in archive file, no similar modules in Le Tracker\n"
+ "Parameter: "
+ "{file_name} "
+ PREFIX_MODULE + " {module_1}[, {module_2}[, ...]]\n"
+ "Example: " + COMMAND_WORD + " hello.json /mod EG2310, EG1311 \n\n"
+ "(2) Import specific modules in archive file, overwrite similar modules in Le Tracker\n"
+ "Parameter: "
+ "{file_name} "
+ PREFIX_MODULE + " {module_1}[, {module_2}[, ...]]\n"
+ "Example: " + COMMAND_WORD + " hello.json /mod EG2310, EG1311 /overwrite true \n\n";

public static final String MESSAGE_SUCCESS = "Modules %1$s imported to Le Tracker";

private final String fileName;
Expand Down

0 comments on commit 82b3066

Please sign in to comment.