Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
4af94dc
Rename Duke to Thoth
Cheng-Zhiyuan Jan 30, 2025
ac9118b
Add greet and exit
Cheng-Zhiyuan Jan 30, 2025
f516682
Improve Thoth to echo command and exit when user input bye
Cheng-Zhiyuan Jan 30, 2025
1b3cf44
Add the ability to store text entered by the user and display them ba…
Cheng-Zhiyuan Jan 30, 2025
5b73d7d
Add the ability to mark tasks status as done and revert the status
Cheng-Zhiyuan Jan 30, 2025
b0187dc
Add a Task class to reperesent tasks
Cheng-Zhiyuan Feb 1, 2025
41bc78c
Integrate Task class with Thoto class
Cheng-Zhiyuan Feb 1, 2025
9eaa586
Integrate Task class with Thoth class
Cheng-Zhiyuan Feb 1, 2025
c855ac5
Merge branch 'master' of https://github.com/Cheng-Zhiyuan/ip
Cheng-Zhiyuan Feb 1, 2025
c0e7679
Add taskManager class to refactor main code
Cheng-Zhiyuan Feb 6, 2025
b87b63b
Add UserInterface class to refactor code
Cheng-Zhiyuan Feb 6, 2025
c6821dc
Update Getter function to get task description
Cheng-Zhiyuan Feb 6, 2025
d6a64d9
Add getter funtion to get task Description
Cheng-Zhiyuan Feb 6, 2025
04602e6
Add getter function to get tasklist, taskcount
Cheng-Zhiyuan Feb 6, 2025
b10d512
Refactor code with userinterface class and taskmanager class
Cheng-Zhiyuan Feb 6, 2025
082dc2c
Add in Todo, Deadline and Event class for week 4
Cheng-Zhiyuan Feb 7, 2025
3024348
Add in Dealine, Todo and Event Class for week 4
Cheng-Zhiyuan Feb 7, 2025
bee16af
Add in mthod to print added tasks
Cheng-Zhiyuan Feb 7, 2025
e73ef0e
Update the overide to correctly overrides the correct parent method
Cheng-Zhiyuan Feb 7, 2025
ccf30e7
Add method to print added tasks
Cheng-Zhiyuan Feb 7, 2025
ea9d7af
Revert "Add in mthod to print added tasks"
Cheng-Zhiyuan Feb 7, 2025
73f6bd3
Integrate Todo, Deadline and Event Class with Thoth
Cheng-Zhiyuan Feb 7, 2025
dc2ded1
Clean up code formats
Cheng-Zhiyuan Feb 7, 2025
965019d
COrrect wrong method used in event
Cheng-Zhiyuan Feb 7, 2025
19b5c20
Revert "COrrect wrong method used in event"
Cheng-Zhiyuan Feb 7, 2025
8515036
Reapply "COrrect wrong method used in event"
Cheng-Zhiyuan Feb 7, 2025
f23118b
Add in excpetion for mark and unmark
Cheng-Zhiyuan Feb 15, 2025
59a61c8
Add in condition checks for dealine, event and todo
Cheng-Zhiyuan Feb 15, 2025
b09ddb2
Orgnize project strucutre
Cheng-Zhiyuan Feb 15, 2025
437ecc3
Add command class and parser class
Cheng-Zhiyuan Feb 20, 2025
d02632d
Delete redundent imports
Cheng-Zhiyuan Feb 20, 2025
3fb4e7e
Change tasklist to arraylist
Cheng-Zhiyuan Feb 20, 2025
4ac766b
Add parser coditon to get command for delete
Cheng-Zhiyuan Feb 20, 2025
3e2ea06
Add abillity to write to data.txt file
Cheng-Zhiyuan Feb 20, 2025
dcf7392
Add ability to rewrite data.txt file after modification
Cheng-Zhiyuan Feb 20, 2025
2860ae8
Add methods to create file, wirte file, savetasks and loadtasks with …
Cheng-Zhiyuan Feb 20, 2025
112a61f
Remove unused code
Cheng-Zhiyuan Feb 20, 2025
4e3f1f5
Update parser to only handle tasks remove default condition
Cheng-Zhiyuan Feb 20, 2025
c652772
Add remove task method
Cheng-Zhiyuan Feb 20, 2025
a9e399f
Add data file creation and load data from data file on startup
Cheng-Zhiyuan Feb 20, 2025
4b70796
Build JAR file
Cheng-Zhiyuan Feb 21, 2025
754d130
Change file path to absolute path
Cheng-Zhiyuan Feb 21, 2025
8ec2349
Input data
Cheng-Zhiyuan Feb 21, 2025
d05461c
Formate code to follow correct spacing
Cheng-Zhiyuan Mar 6, 2025
ce91da0
Add final else statment to catch unwated errors
Cheng-Zhiyuan Mar 6, 2025
618ce95
Add FindCommand class
Cheng-Zhiyuan Mar 6, 2025
370cc3f
Update Absolute path to relative path
Cheng-Zhiyuan Mar 6, 2025
f82483d
Remove unused import
Cheng-Zhiyuan Mar 6, 2025
fd0b686
Add javadoc comments
Cheng-Zhiyuan Mar 7, 2025
237178f
Update readme with basic user guide
Cheng-Zhiyuan Mar 13, 2025
923ec07
Delete unused imports
Cheng-Zhiyuan Mar 13, 2025
582659f
Fixed bux of printing wrong user output
Cheng-Zhiyuan Mar 13, 2025
3c1e59e
Update Readme
Cheng-Zhiyuan Mar 13, 2025
b814be2
Update Readme with descriptions
Cheng-Zhiyuan Mar 13, 2025
cfb6e70
Fixed Grammer error
Cheng-Zhiyuan Mar 13, 2025
181fc0e
Update data files
Cheng-Zhiyuan Mar 14, 2025
b7f39a1
Add in javadoc headers
Cheng-Zhiyuan Mar 14, 2025
b4fbbda
Merge pull request #1 from Cheng-Zhiyuan/branch-A-JavaDoc
Cheng-Zhiyuan Mar 14, 2025
b5abe09
Fix bug for out of bound task index
Cheng-Zhiyuan Mar 14, 2025
794b36d
Merge pull request #2 from Cheng-Zhiyuan/branch_Level_9
Cheng-Zhiyuan Mar 14, 2025
e328d1d
update gitignore file
Cheng-Zhiyuan Mar 14, 2025
cc0974d
Fix out of bound task index bug
Cheng-Zhiyuan Mar 14, 2025
ff3d1b7
Restructure code from packages to reduce redundency
Cheng-Zhiyuan Mar 27, 2025
58b644d
Add in Task Parser to load txt to tasks
Cheng-Zhiyuan Mar 27, 2025
2182a76
Refactor parser class
Cheng-Zhiyuan Mar 27, 2025
163f214
Add in Exceptions class
Cheng-Zhiyuan Mar 27, 2025
cdec039
Add in exception for storage to task parsing
Cheng-Zhiyuan Mar 27, 2025
0fe8a0d
update exceptions and cath
Cheng-Zhiyuan Mar 27, 2025
33efbac
Reformat code
Cheng-Zhiyuan Mar 27, 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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ bin/

/text-ui-test/ACTUAL.TXT
text-ui-test/EXPECTED-UNIX.TXT

#.class files
*.class

#data.txt
/data/data.txt
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Duke project template
# Thoth project template

This is a project template for a greenfield Java project. It's named after the Java mascot _Duke_. Given below are instructions on how to use it.

Expand All @@ -13,7 +13,7 @@ Prerequisites: JDK 17, update Intellij to the most recent version.
1. If there are any further prompts, accept the defaults.
1. Configure the project to use **JDK 17** (not other versions) as explained in [here](https://www.jetbrains.com/help/idea/sdk.html#set-up-jdk).<br>
In the same dialog, set the **Project language level** field to the `SDK default` option.
1. After that, locate the `src/main/java/Duke.java` file, right-click it, and choose `Run Duke.main()` (if the code editor is showing compile errors, try restarting the IDE). If the setup is correct, you should see something like the below as the output:
1. After that, locate the `src/main/java/Thoth.java` file, right-click it, and choose `Run Thoth.main()` (if the code editor is showing compile errors, try restarting the IDE). If the setup is correct, you should see something like the below as the output:
```
Hello from
____ _
Expand Down
3 changes: 3 additions & 0 deletions data/data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[E][X] work on CS2113 IP (from: 13/03/2025 12 noon to: 13/03/2025 4 pm)
[E][ ] sleep (from: now to: never)
[D][X] sleep (by: 11pm)
164 changes: 150 additions & 14 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,166 @@
# Duke User Guide
# Thoth User Guide
Thoth Task Manager is a command-line application designed to help you manage your daily tasks efficiently. It supports adding todos, deadlines, and events, as well as marking tasks as done, unmarking them, deleting tasks, and searching for tasks. This README provides an overview of the application, installation instructions, usage details, and troubleshooting tips.

// Update the title above to match the actual product name
Thoth Task Manager enables you to manage three main types of tasks:

// Product screenshot goes here
- **Todos:** Simple tasks that need to be done.
- **Deadlines:** Tasks that must be completed by a specific date/time.
- **Events:** Tasks that occur within a specified time range.

// Product intro goes here
Users interact with the application via a command-line interface (CLI) by entering commands that the system parses and executes. Each command is processed through a central parser that maps user input to the corresponding functionality.

## Adding deadlines
When you start Thoth Task Manager, you will be greeted with a welcome message followed by a prompt where you can enter your commands. The application continuously listens for your input until you choose to exit.

// Describe the action and its outcome.
## Available Commands
### Exiting the Application: _bye_

// Give examples of usage
The bye command terminates the application gracefully. It prints a goodbye message to indicate that the session is closing.

Example: `keyword (optional arguments)`
Syntax:
```
bye
```
Example code:
```
bye
```
Sample output:
```
Bye. Hope to see you again soon!
```

### Listing the Task Lists: _list_

// A description of the expected outcome goes here
The list command prints the list of the users to the screen of the CLI software

Syntax:
```
list
```
expected output
Example code:
```
list
```
Sample output:
```
1. [T][ ] eat
2. [T][ ] sleep
3. [T][ ] repeat
```
### Adding a todo task : _todo_
The `todo` command adds a new simple task without any associated deadline or time.

## Feature ABC
Syntax:
```
todo TASK_DESCRIPTION
```
Example code:
```
todo work on CS2113 IP
```
Sample output:
```
Got it. I've added this task:
[T][ ] work on CS2113 IP
Now you have 4 tasks in the list.
```
### Adding a deadline task : _deadline_
The `deadline` command creates a task with a deadline. Both a task description and a deadline time must be specified.

// Feature details
Syntax:
```
deadline TASK_DESCRIPTION /by DEADLINE_TIME
```
Example code:
```
deadline work on CS2113 IP /by tody 2359
```
Sample output:
```
Got it. I've added this task:
[D][ ] work on CS2113 IP (by: today 2359)
Now you have 5 tasks in the list.
```
### Adding an event task : _event_
The `event` command schedules a task that occurs during a specified time range. The task description, start and end time of the event must be specified.

Syntax:
```
event TASK_DESCRIPTION /from START_TIME /to END_TIME
```
Example code:
```
event work on CS2113 IP /from 13/03/2025 12 noon /to 13/03/2025 4 pm
```
Sample output:
```
Got it. I've added this task:
[E][ ] work on CS2113 IP (from: 13/03/2025 12 noon to: 13/03/2025 4 pm)
Now you have 6 tasks in the list.
```
### Marking a task as Done: _mark_
The `mark` command sets a task's status to the done state.

## Feature XYZ
Syntax:
```
mark TASK_LIST_INDEX
```
Example code:
```
mark 1
```
Sample Output:
```
Nice! I've marked this task as done:
[T][X] eat
```
### Marking a task as Not Done: _unmark_
The `unmark` command reverts a task's status back to the not done state.
Syntax:
```
unmark TASK_LIST_INDEX
```
Example code:
```
unmark 1
```
Sample Output:
```
OK, I've marked this task as not done yet:
[T][ ] eat
```
### Deleting a task from the task list: _delete_
The `delete` command removes a specified task from your list.

Syntax:
```
detele TASK_LIST_INDEX
```
Example code:
```
delete 2
```
Sample Output:
```
Noted. I've removed this task:
[T][ ] sleep
Now you have 5 tasks in the list.
```
### Finding tasks with a string: _find_
The `find` command searches for tasks containing a specified keyword (case-insensitive) and displays the matching tasks.

// Feature details
Syntax:
```
find KEYWORD
```
Example code:
```
find CS2113
```
Sample Output:
```
Here are the matching tasks:
1. [T][ ] work on CS2113 IP
2. [D][ ] work on CS2113 IP (by: today 2359)
3. [E][ ] work on CS2113 IP (from: 13/03/2025 12 noon to: 13/03/2025 4 pm)
```
10 changes: 0 additions & 10 deletions src/main/java/Duke.java

This file was deleted.

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: thoth.Thoth

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

import thoth.parser.TaskParser;
import thoth.tasks.Task;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;


public class Storage {

private static final String DEFAULT_FILE_PATH = "data/data.txt";
private static final int MIN_HEADER_SIZE = 7;
private static final int TYPE_INDEX = 1;
private static final int DONE_INDEX = 4;

/**
* Create a file to store data
*
* @throws IOException if an I/O error occurs while creating the file
*/
public static void createFile() throws IOException {
File file = new File(DEFAULT_FILE_PATH);

// Ensure the parent directories exist (if there are any)
if (file.getParentFile() != null) {
file.getParentFile().mkdirs();
}
// Create the file if it doesn't already exist
if (!file.exists()) {
file.createNewFile();
}
}

/**
* Add a new line into the file with the user input
*
* @param input the string to be written to the file
* @throws IOException if an I/O error occurs while writing to this file
*/
public static void writeFile(String input) throws IOException {
try (FileWriter fw = new FileWriter(DEFAULT_FILE_PATH, true)) {
fw.append(input).append(System.lineSeparator());
}
}

/**
* Saves the list of tasks into the data file
*
* @param tasks the task list that is to be saved
* @throws IOException if an I/O error occurs while writing to this file
*/
public static void saveTasks(List<Task> tasks) throws IOException {
try (FileWriter fw = new FileWriter(DEFAULT_FILE_PATH, false)) {
for (Task t : tasks) {
fw.write(t.getTaskString() + System.lineSeparator());
}
}
}

/**
* Load the task from the data file
*
* @return a list of tasks loaded from the file or an empty list if the file does not exist
* @throws IOException if an I/O error occurs while writing to this file
*/
public static List<Task> loadTasks() throws IOException {
List<Task> tasks = new ArrayList<>();
File f = new File(DEFAULT_FILE_PATH);
if (!f.exists()) {
return tasks; // no file => no tasks
}

try (Scanner s = new Scanner(f)) {
while (s.hasNextLine()) {
String line = s.nextLine().trim();
Task t = TaskParser.parseLineToTask(line);
if (t != null) {
tasks.add(t);
}
}
}

return tasks;
}


}
Loading