Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
219f7a4
Add Flaaaash remove Duke.
Flaaaash Jan 31, 2025
c85bf1c
Add increment 1-3. Add Task class
Flaaaash Feb 6, 2025
f915452
Add sub-classes Todo, Deadline and Event of Task class.
Flaaaash Feb 6, 2025
ef0e0e5
Level-5. Exception handling
Flaaaash Feb 14, 2025
85505a1
Merge branch 'branch-Level-5'
Flaaaash Feb 14, 2025
97802b2
Add deleteTask(). Change tasks array to a ArrayList type for dynamic …
Flaaaash Feb 20, 2025
fc1b49a
Add save and load methods.
Flaaaash Feb 21, 2025
49f4871
Level-7
Flaaaash Feb 21, 2025
9afe0b6
Merge branch 'master' into branch-Level-6
Flaaaash Feb 21, 2025
114008a
Merge branch 'branch-Level-7'
Flaaaash Feb 21, 2025
a669331
Fixed a naming conflict.
Flaaaash Feb 21, 2025
790d185
A-Packages
Flaaaash Feb 21, 2025
237eb84
Apply a more OOP design
Flaaaash Mar 13, 2025
7dc40ad
Completed HelpCommand class.
Flaaaash Mar 13, 2025
b02cb4c
Add FindCommand class to handle level-9 task finding matching task.
Flaaaash Mar 13, 2025
446f8e5
Merge pull request #1 from Flaaaash/branch-Level-9
Flaaaash Mar 13, 2025
856350a
Merge branch 'master' of https://github.com/Flaaaash/ip
Flaaaash Mar 13, 2025
4bcfc50
Add header comments to most non-private classes/methods, and non-triv…
Flaaaash Mar 13, 2025
dc40b48
Merge pull request #2 from Flaaaash/branch-A-JavaDoc
Flaaaash Mar 13, 2025
433eba8
Merge branch 'master' of https://github.com/Flaaaash/ip
Flaaaash Mar 13, 2025
8d595d9
Update README.md (unfinished).
Flaaaash Mar 14, 2025
0884152
Minor changes.
Flaaaash Mar 14, 2025
989918e
Finished User Guide.
Flaaaash Mar 14, 2025
1e5f56c
Update Release link in README.md.
Flaaaash Mar 14, 2025
ab5fc69
Change StorageFile default storage path to save by file name.
Flaaaash Mar 31, 2025
02d6c4b
Remove local data.
Flaaaash Mar 31, 2025
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
117 changes: 101 additions & 16 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,115 @@
# Duke User Guide
# Flaaaash User Guide

// Update the title above to match the actual product name
Flaaaash is a simple command-line task management application
that helps users keep track of their tasks efficiently.
Users can create tasks, mark them as done, delete them,
and list all tasks. The application also supports saving and
loading tasks from a file to persist data between sessions.

// Product screenshot goes here
--------------------------------------------------------------

// Product intro goes here
## Quick Start

## Adding deadlines
1. Ensure you have Java 17 or above installed in your Computer.\
Mac users: Ensure you have the precise JDK version prescribed [here](https://se-education.org/guides/tutorials/javaInstallationMac.html).

// Describe the action and its outcome.
2. Download the latest .jar file from [here](https://github.com/Flaaaash/ip/releases).

// Give examples of usage
3. Copy the file to the folder you want to use as the home folder for your Flaaaash chatbot.

Example: `keyword (optional arguments)`
4. Open a command terminal, cd into the folder you put the jar file in, and use the java -jar Flaaaash.jar command to run the application.

// A description of the expected outcome goes here
5. Type the command in the command box and press Enter to execute it. e.g. typing help and pressing Enter will open the help window.
Some example commands you can try:

```
expected output
```
- `list` : Lists all tasks.

## Feature ABC
- `todo Read a book`: Adds a todo task named Read a book to the task list.

// Feature details
- `delete 1` : Deletes the 1st task shown in the current list.

- `exit` : Exits the app.

## Feature XYZ
6. Refer to the Features below for details of each command.

// Feature details
--------------------------------------------------------------------------

## Features


Notes about the command format:
- Words in `UPPER_CASE` are the parameters to be supplied by the user.\
e.g. in `todo TASK_NAME`, `TASK_NAME` is a parameter which can be used as `todo Read a Book`.
- Parameters have a fixed order.
e.g. if the command specifies `/from START_TIME /to END_TIME`, no other order of input is acceptable.
- Extraneous parameters for commands that do not take in parameters (such as `help`, `list`, and `exit`) will be ignored.
e.g. if the command specifies `help 123`, it will be interpreted as `help`.

### Viewing help : `help`
Shows a message explaining all available commands.\
Format: `help`

### Terminating the program : `exit`
Exit the program.\
Format: `exit`

### Adding a todo task: `todo`
Adds a task with no specified time constraints to the task list.\
Format: `todo TASK_NAME`\
Example:
- `todo Read a book`
- `todo Exercise`

### Adding a deadline task: `deadline`
Adds a task with a deadline to the task list.\
Format: `deadline TASK_NAME /by DEADLINE`\
Example:
- `deadline Return the book /by this Saturday`
- `deadline Finish math homework /by tomorrow`

### Adding a event task: `event`
Adds a task with a specified start time and end time to the task list.\
Format: `event TASK_NAME /from START_TIME /to END_TIME`\
Example:
- `event Attend book fair /from 24th April 2025 2pm /to 4pm `

### Listing all tasks : `list`
Shows a list of all tasks in the task list.\
Format: `list`

### Finding tasks with specified keyword(s): `find`
Finds tasks of which contents contain the given keywords.\
Format: `find KEYWORD`
- The search is case-insensitive. e.g read will match Read.
- The order of the keywords **MATTERS**.
- Only the task name is searched.

### Deleting a task : delete
Deletes the specified task from the task list.\
Format: `delete INDEX`

- Deletes the task at the specified INDEX.
- The index refers to the index number shown in the task list (not applicable to the find list).
- The index must be a positive integer.

Examples:
- `delete 2` deletes the 2nd task in the task list.

### Marking a task as done : `mark`
Mark a task as done.\
Format: `mark INDEX`

- Marks the task at the specified INDEX.
- The index refers to the index number shown in the task list (not applicable to the find list).
- The index must be a positive integer.

### Marking a task as undone : `unmark`
Mark a task as undone.\
Format: `unmark INDEX`

- Unmarks the task at the specified INDEX.
- The index refers to the index number shown in the task list (not applicable to the find list).
- The index must be a positive integer.

## Saving the data
Task List data are saved in the hard disk automatically after any command that changes the data. There is no need to save manually.
10 changes: 0 additions & 10 deletions src/main/java/Duke.java

This file was deleted.

85 changes: 85 additions & 0 deletions src/main/java/Flaaaash.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import commands.Command;
import commands.ExitCommand;
import data.TaskList;
import parser.Parser;
import storage.StorageFile;
import storage.StorageFile.StorageOperationException;
import ui.TextUi;

/**
* Entry point of the Flaaaash chatbot application.
* Initialises the application and starts the interaction with the user.
*/
public class Flaaaash {

/** Version info of the program. */
public final String VERSION = "Chatbot Flaaaash Version-0.2";
public static final String DEFAULT_STORAGE_FILEPATH = "./data/Flaaaash.txt";

private TextUi ui;
private TaskList taskList;
private StorageFile storage;

public static void main(String[] args) { new Flaaaash().run(); }

/** Runs the program until termination. */
public void run() {
start();
runCommandLoopUntilExitCommand();
exit();
}

/**
* Sets up the required objects, loads up the data from the storage file, and prints the welcome message.
*/
public void start() {
try {
this.ui = new TextUi();
ui.showWelcomeMessage(VERSION);
this.storage = new StorageFile(DEFAULT_STORAGE_FILEPATH);
this.taskList = storage.load();
} catch (StorageOperationException e) {
ui.showInitFailedMessage();
this.taskList = new TaskList();
}
}

/** Reads the user command and executes it, until the user issues the exit command. */
public void runCommandLoopUntilExitCommand() {
Command command;
do {
String userCommandText = ui.getUserCommand();
command = new Parser().parseCommand(userCommandText);
String result = executeCommand(command);
ui.showToUser(result);
} while (!ExitCommand.isExit(command));
}

/** Prints the Goodbye message and terminates the program. */
private void exit() {
ui.showGoodbyeMessage();
System.exit(0);
}

/**
* Executes the command and returns the result.
*
* @param command user command
* @return result string of the command
*/
public String executeCommand(Command command) {
try {
command.setTaskList(taskList);
String result = command.execute();
storage.save(taskList);
return result;
} catch (Exception e) {
ui.showToUser(e.getMessage());
throw new RuntimeException(e);
}
}
}




3 changes: 3 additions & 0 deletions src/main/java/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: Flaaaash

25 changes: 25 additions & 0 deletions src/main/java/commands/Command.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package commands;

import data.TaskList;

/**
* Represents an executable command.
*/
public class Command {
protected TaskList taskList;

/**
* Executes the command and returns the result.
*/
public String execute() {
throw new UnsupportedOperationException("This method is to be implemented by child classes");
};

/**
* Supplies the data the command will operate on.
*/
public void setTaskList(TaskList taskList) {
this.taskList = taskList;
}

}
31 changes: 31 additions & 0 deletions src/main/java/commands/DeadlineCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package commands;

import data.task.Deadline;

/**
* Adds a deadline task to the task list.
*/
public class DeadlineCommand extends Command {

public static final String COMMAND_WORD = "deadline";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a deadline task to the task list.\n"
+ "Parameters: TASK_NAME /by DEADLINE\n"
+ " -Example: " + COMMAND_WORD
+ " Return a book /by Saturday";

private final Deadline deadline;

public DeadlineCommand(String taskName, String deadline) {
this.deadline = new Deadline(taskName, deadline);
}

public String execute() {
taskList.addTask(deadline);
StringBuilder sb = new StringBuilder();
sb.append("Got it. I've added this task:").append("\n");
sb.append(" ").append(deadline.toString()).append("\n");
sb.append("Now you have ").append(taskList.size()).append(" tasks in the list.");
return sb.toString();
}
}
33 changes: 33 additions & 0 deletions src/main/java/commands/DeleteCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package commands;

/**
* Deletes a task identified using its index in the task list.
*/
public class DeleteCommand extends Command {

public static final String COMMAND_WORD = "delete";

public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Delete the task with target index number.\n"
+ " -Example: " + COMMAND_WORD
+ " 1";


private final int taskIndex;

public DeleteCommand(int taskIndex) {
this.taskIndex = taskIndex;
}

public String execute() {
if (taskIndex < 1 || taskIndex > taskList.size()) {
return String.format("Index %d is invalid", taskIndex);
}
StringBuilder sb = new StringBuilder();
sb.append("Noted. I've removed this tasks:").append("\n")
.append(" ").append(taskList.get(taskIndex - 1).toString()).append("\n");
taskList.deleteTask(taskIndex - 1);
sb.append("Now you have ").append(taskList.size()).append(" tasks in the list.");
return sb.toString();
}
}
31 changes: 31 additions & 0 deletions src/main/java/commands/EventCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package commands;

import data.task.Event;

/**
* Adds an event task to the task list.
*/
public class EventCommand extends Command {

public static final String COMMAND_WORD = "event";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a event task to the task list.\n"
+ "Parameters: TASK_NAME /from EVENT_START_TIME /to EVENT_END_TIME\n"
+ " -Example: " + COMMAND_WORD
+ " Final exam /from 29 April 2025 2:00pm /to 4:00pm";

private final Event event;

public EventCommand(String taskName, String from, String to) {
this.event = new Event(taskName, from, to);
}

public String execute() {
taskList.addTask(event);
StringBuilder sb = new StringBuilder();
sb.append("Got it. I've added this task:").append("\n");
sb.append(" ").append(event.toString()).append("\n");
sb.append("Now you have ").append(taskList.size()).append(" tasks in the list.");
return sb.toString();
}
}
22 changes: 22 additions & 0 deletions src/main/java/commands/ExitCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package commands;

/**
* Terminates the program.
*/
public class ExitCommand extends Command {

public static final String COMMAND_WORD = "exit";

public static final String MESSAGE_EXIT = "Exiting program as requested ...";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Exits the program.";

@Override
public String execute() {
return MESSAGE_EXIT;
}

public static boolean isExit(Command command) {
return command instanceof ExitCommand; // instanceof returns false if it is null
}
}
Loading