Skip to content

Commit

Permalink
add help command
Browse files Browse the repository at this point in the history
  • Loading branch information
zunedz committed Feb 14, 2022
1 parent b458563 commit 889e204
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/main/java/duke/command/HelpCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package duke.command;

import duke.exception.DukeException;
import duke.stack.CallStack;
import duke.task.TaskList;
import duke.util.Constants;

public class HelpCommand extends Command {
@Override
public String executeCommand(TaskList taskList, CallStack callStack) throws DukeException {
return Constants.HELP_MESSAGE;
}
}
14 changes: 13 additions & 1 deletion src/main/java/duke/util/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
public class Constants {
public static final String HORIZONTAL_LINE = "____________________________________________________________";

public static final String GREETINGS = "Hello there, I am Giga Chad Duke\nHow can I help you?";
public static final String GREETINGS = "Hello there, I am Giga Chad Duke.\nHow can I help you?\nType help to list " +
"all the commands.";

public static final String BYE = "Bye, hope to see you again soon!";

Expand All @@ -25,4 +26,15 @@ public class Constants {

public static final int DELAY = 400;

public static final String HELP_MESSAGE = "Here are the list of commands:\n" +
"1. list: list out all of your tasks\n" +
"2. todo <task>: add a todo task into your task list\n" +
"3. deadline <task> /by <deadline>: add a deadline into your task list\n" +
"4. even <task> /at <time>: add an event into your task list\n" +
"5. mark <inde>: mark a task at specified index as done\n" +
"6. unmark <index>: unmark a task at specified index as not done yet\n" +
"7. delete <index>: delete a task at sepcified index\n" +
"8. find <keyword>: find a task that containst keyword\n" +
"9. undo: undo your last action\n" +
"10. bye: termintate this program";
}
2 changes: 2 additions & 0 deletions src/main/java/duke/util/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public static Command parse(String line) throws DukeException {
return new DeleteCommand(taskId);
case "undo":
return new UndoCommand();
case "help":
return new HelpCommand();
default:
throw new CommandNotFoundException();
}
Expand Down

0 comments on commit 889e204

Please sign in to comment.