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.11][F09-1]Jonathan Ng #183

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/seedu/addressbook/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
*/
public class Main {

public static boolean isUserInputHelp;

/** Version info of the program. */
public static final String VERSION = "AddressBook Level 2 - Version 1.0";

Expand Down Expand Up @@ -84,6 +86,9 @@ private void runCommandLoopUntilExitCommand() {
do {
String userCommandText = ui.getUserCommand();
command = new Parser().parseCommand(userCommandText);
if(userCommandText.equals("help")) {

Choose a reason for hiding this comment

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

This one is very minor, just need to note that Java reserved words should be followed by a white space. eg.
if (userCommandText.equals("help")) {

isUserInputHelp = true;
}
CommandResult result = executeCommand(command);
recordResult(result);
ui.showResultToUser(result);
Expand Down
29 changes: 18 additions & 11 deletions src/seedu/addressbook/commands/HelpCommand.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package seedu.addressbook.commands;


import seedu.addressbook.Main;

/**
* Shows help instructions.
*/
Expand All @@ -15,16 +17,21 @@ public HelpCommand() {}

@Override
public CommandResult execute() {
return new CommandResult(
AddCommand.MESSAGE_USAGE
+ "\n" + DeleteCommand.MESSAGE_USAGE
+ "\n" + ClearCommand.MESSAGE_USAGE
+ "\n" + FindCommand.MESSAGE_USAGE
+ "\n" + ListCommand.MESSAGE_USAGE
+ "\n" + ViewCommand.MESSAGE_USAGE
+ "\n" + ViewAllCommand.MESSAGE_USAGE
+ "\n" + HelpCommand.MESSAGE_USAGE
+ "\n" + ExitCommand.MESSAGE_USAGE
);
if(!Main.isUserInputHelp) {
System.out.println("Command not found, for more help, please enter 'help' to the CLI");
} else {
return new CommandResult(
"\n" + AddCommand.MESSAGE_USAGE
+ "\n\n" + DeleteCommand.MESSAGE_USAGE
+ "\n\n" + ClearCommand.MESSAGE_USAGE
+ "\n\n" + FindCommand.MESSAGE_USAGE
+ "\n\n" + ListCommand.MESSAGE_USAGE
+ "\n\n" + ViewCommand.MESSAGE_USAGE
+ "\n\n" + ViewAllCommand.MESSAGE_USAGE
+ "\n\n" + HelpCommand.MESSAGE_USAGE
+ "\n\n" + ExitCommand.MESSAGE_USAGE
);
}
return new CommandResult(HelpCommand.MESSAGE_USAGE);
}
}
2 changes: 0 additions & 2 deletions src/seedu/addressbook/commands/IncorrectCommand.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package seedu.addressbook.commands;


/**
* Represents an incorrect command. Upon execution, produces some feedback to the user.
*/
Expand All @@ -16,5 +15,4 @@ public IncorrectCommand(String feedbackToUser) {
public CommandResult execute() {
return new CommandResult(feedbackToUser);
}

}