Skip to content

Commit

Permalink
Add help
Browse files Browse the repository at this point in the history
  • Loading branch information
dianneloh9 committed Sep 15, 2020
1 parent 35d58e9 commit 10debcc
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,5 @@ checkstyle {

run{
standardInput = System.in
enableAssertions = true
}
5 changes: 3 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ chat interface also gives users a more personal feeling.
1. Ensure that you have Java `11` or above installed on your computer.
2. Download the latest Duke Jar from [here](https://github.com/dianneloh9/ip/releases/tag/A-Release).
3. Copy the file to the folder you want to use as the *home folder* for your Duke program.
4. Double click the file to start the app. You should see the below GUI after a few seconds:
4. Double click the file to start the app for Windows, or run `java -jar duke.jar` for Mac.
You should see the below GUI after a few seconds:
![landing page](/docs/landing.png)
5. Type the command in the command box and press Enter to execute it.

Expand Down Expand Up @@ -173,7 +174,7 @@ Format: `find KEYWORD...`
- The order of the keywords does not matter, that is, `read book` or
`book read` will show the same result.
- Only the task description is searched.
- Only full words will be matched (eg `boo` will not match `book`);
- Partial words can be matched (eg `boo` will match `book`);
- Only tasks matching all keywords will be returned.

Examples:
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/duke/commands/HelpCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package duke.commands;

import static duke.utils.Messages.MESSAGE_HELP;

import duke.tasklist.TaskList;

public class HelpCommand extends Command {
@Override
public CommandResult execute(TaskList taskList) {
return new CommandResult(MESSAGE_HELP, false);
}
}
7 changes: 7 additions & 0 deletions src/main/java/duke/parsers/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import duke.commands.DeleteCommand;
import duke.commands.DoneCommand;
import duke.commands.FindCommand;
import duke.commands.HelpCommand;
import duke.commands.ListCommand;
import duke.commands.TodayCommand;
import duke.exceptions.DukeDateTimeParseException;
Expand Down Expand Up @@ -86,11 +87,17 @@ public static Command parse(String userInput) throws EmptyTaskDescriptionExcepti
throw new InvalidCommandFormatException();
}
return parseConfirm(splitByCommand[1].strip());
case "help":
return parseHelp();
default:
throw new InvalidCommandException();
}
}

private static Command parseHelp() {
return new HelpCommand();
}

private static Command parseToday() {
return new TodayCommand();
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/duke/utils/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ public class Messages {
+ "| | | | | | | |/ / _ \\\n"
+ "| |_| | |_| | < __/\n"
+ "|____/ \\__,_|_|\\_\\___|\n";
public static final String MESSAGE_GREETING = "\t Hello! I'm Duke\n\t Here are the available commands:\n"
public static final String MESSAGE_BYE = "\t Bye. Hope to see you again soon!";
public static final String MESSAGE_HELP = "\t Here are the available commands:\n"
+ "\t \u2022 Create a todo (eg todo <task>)\n"
+ "\t \u2022 Create an event (eg event <eventName> /at <date/time(s)>)\n"
+ "\t \u2022 Create a deadline (eg deadline <deadlineName> /by <date/time>\n"
Expand All @@ -19,8 +20,7 @@ public class Messages {
+ "\t \u2022 List today's task (eg today)\n"
+ "\t \u2022 Confirm a date/time (eg confirm <task index> <date/time index>\n"
+ "\t \u2022 Exit the program (eg bye)\n";
public static final String MESSAGE_BYE = "\t Bye. Hope to see you again soon!";

public static final String MESSAGE_GREETING = "\t Hello! I'm Duke\n" + MESSAGE_HELP;
public static final String MESSAGE_ADD_TASK = "\t Got it. I've added this task:\n";
public static final String MESSAGE_DELETE_TASK = "\t Noted. I've removed this task:\n";
public static final String MESSAGE_DONE_TASK = "\t Nice! I've marked this task as done:\n";
Expand Down

0 comments on commit 10debcc

Please sign in to comment.