Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[W5.7][F10-2]Lim Fong Yuan #454

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
4 changes: 1 addition & 3 deletions src/seedu/addressbook/commands/ClearCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ public class ClearCommand extends Command {

public static final String COMMAND_WORD = "clear";
public static final String MESSAGE_USAGE = Command.getMessageUsage(COMMAND_WORD,
"Clears address book permanently.",
"none",
"");
"Clears address book permanently.");

public static final String MESSAGE_SUCCESS = "Address book has been cleared!";

Expand Down
15 changes: 14 additions & 1 deletion src/seedu/addressbook/commands/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,20 @@ protected static String getMessageUsage(

return commandWord + ": " + commandDesc + "\n"
+ " Parameters: " + commandParams + "\n"
+ " Example: " + commandWord + " " + commandEgParams;
+ " Example: " + commandWord + (commandEgParams.equals("") ? "" : " " + commandEgParams);
}

/**
* Overloaded getMessageUsage() for commands that take in no parameters
* @param commandWord The command's COMMAND_WORD
* @param commandDesc A brief description of what the command does
* @return the MESSAGE_USAGE for a command.
*/
protected static String getMessageUsage(
String commandWord,
String commandDesc) {

return getMessageUsage(commandWord, commandDesc, "none", "");
}

/**
Expand Down
6 changes: 2 additions & 4 deletions src/seedu/addressbook/commands/ExitCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ public class ExitCommand extends Command {
public static final String COMMAND_WORD = "exit";

public static final String MESSAGE_USAGE = Command.getMessageUsage(COMMAND_WORD,
"Exits the program.",
"none",
"");

"Exits the program.");

public static final String MESSAGE_EXIT_ACKNOWEDGEMENT = "Exiting Address Book as requested ...";

@Override
Expand Down
4 changes: 1 addition & 3 deletions src/seedu/addressbook/commands/HelpCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ public class HelpCommand extends Command {
public static final String COMMAND_WORD = "help";

public static final String MESSAGE_USAGE = Command.getMessageUsage(COMMAND_WORD,
"Shows program usage instructions.",
"none",
"");
"Shows program usage instructions.");

@Override
public CommandResult execute() {
Expand Down
4 changes: 1 addition & 3 deletions src/seedu/addressbook/commands/ListCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ public class ListCommand extends Command {
public static final String COMMAND_WORD = "list";

public static final String MESSAGE_USAGE = Command.getMessageUsage(COMMAND_WORD,
"Displays all persons in the address book as a list with index numbers.",
"none",
"");
"Displays all persons in the address book as a list with index numbers.");


@Override
Expand Down
8 changes: 4 additions & 4 deletions test/expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
|| Example: delete 1
|| clear: Clears address book permanently.
|| Parameters: none
|| Example: clear
|| Example: clear
|| find: Finds all persons whose names contain any of the specified keywords (case-sensitive) and displays them as a list with index numbers.
|| Parameters: KEYWORD [MORE_KEYWORDS]...
|| Example: find alice bob charlie
|| list: Displays all persons in the address book as a list with index numbers.
|| Parameters: none
|| Example: list
|| Example: list
|| view: Views the non-private details of the person identified by the index number in the last shown person listing.
|| Parameters: INDEX
|| Example: view 1
Expand All @@ -29,10 +29,10 @@
|| Example: viewall 1
|| help: Shows program usage instructions.
|| Parameters: none
|| Example: help
|| Example: help
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the script uses a 'diff', whitespace might be causing the CI to fail.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's strange, because both my expected and my actual output do not have any whitespace at the end of line 32.

I've made a clean clone of this branch to my com and ran runtests.bat, and it reports no difference as well.

I did change the formatting of the text files while I was working on this while I was troubleshooting why the identical-looking files are being reported as different. Maybe that's the issue instead?

|| exit: Exits the program.
|| Parameters: none
|| Example: exit
|| Example: exit
|| ===================================================
|| Enter command: || [Command entered: delete 1]
|| The person index provided is invalid
Expand Down