Skip to content
Merged
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
39 changes: 39 additions & 0 deletions src/main/java/lars/command/HelpCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package lars.command;

import lars.storage.Storage;
import lars.task.TaskList;
import lars.ui.Ui;

/**
* Represents a command that displays a help message listing all available commands and their formats.
* This command guides the user on how to interact with the Lars application effectively.
*/
public class HelpCommand extends Command {

@Override
public void execute(TaskList tasks, Ui ui, Storage storage) {
this.response =
"Here are the commands you can use:\n\n"
+ "1. list\n\n"

+ "2. todo <description>\n"
+ " 👉Example:\n"
+ " todo read book\n\n"

+ "3. deadline <description> /by <date>\n"
+ " 👉Examples:\n"
+ " 1. deadline submit report /by 2026-02-15\n"
+ " 2. deadline return library book /by 2026-02-15 1800\n"
+ " 3. deadline return library book /by Sunday\n\n"

+ "4. event <description> /from <start> /to <end>\n"
+ " 👉Example:\n"
+ " event meeting /from 2pm /to 4pm\n\n"

+ "5. mark <number>\n"
+ "6. unmark <number>\n"
+ "7. delete <number>\n"
+ "8. remind (or press ⏰)\n"
+ "9. bye";
}
}
5 changes: 5 additions & 0 deletions src/main/java/lars/parser/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import lars.command.Command;
import lars.command.DeleteCommand;
import lars.command.ExitCommand;
import lars.command.HelpCommand;
import lars.command.ListCommand;
import lars.command.MarkCommand;
import lars.command.RemindCommand;
Expand Down Expand Up @@ -101,6 +102,10 @@ public static Command parse(String fullCommand) throws LarsException {

case "remind":
return new RemindCommand();

case "help":
return new HelpCommand();

default:
throw new LarsException("I'm sorry, but I don't know what that means :-(");
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/lars/ui/Ui.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public void printLine() {
/**
* Returns the welcome message shown to the user.
*/
// 在 Ui.java 中添加
public String getWelcomeMessage() {
return "Hello! I'm Lars\nWhat can I do for you?";
return "Hello! I'm Lars 💛💜\nSo glad to see you\n"
+ "You can type \"help\" to see what I can do 🧞‍";
}

/**
Expand Down