Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Liu Ze Hui] iP #192

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
215dbb8
add Duke.java level 0
liuzehui03 Feb 2, 2024
da5bbbb
added level-1
liuzehui03 Feb 8, 2024
5b9ead6
Level-2
liuzehui03 Feb 8, 2024
bec25f4
Level-3
liuzehui03 Feb 8, 2024
6c1ed56
no message
liuzehui03 Feb 22, 2024
5769d82
Level-5
liuzehui03 Feb 22, 2024
52ab112
changes to Deadline event and Todo
liuzehui03 Mar 5, 2024
09dad06
testing
liuzehui03 Mar 5, 2024
8934c19
handle exceptions
liuzehui03 Mar 6, 2024
5667b2a
package
liuzehui03 Mar 6, 2024
4c010a4
Merge branch 'branch-Level-5'
liuzehui03 Mar 6, 2024
1163469
rename package
liuzehui03 Mar 6, 2024
ca4c4c6
rename package
liuzehui03 Mar 6, 2024
755cb31
Merge branch 'trial'
liuzehui03 Mar 6, 2024
75014ee
created List.java
liuzehui03 Mar 6, 2024
e3469f4
changed to ArrayList
liuzehui03 Mar 6, 2024
96d7ab0
delete function fixed
liuzehui03 Mar 6, 2024
6e92e2d
fixing save data
liuzehui03 Mar 7, 2024
058b7df
Merge branch 'branch-Level-6'
liuzehui03 Mar 7, 2024
1f259ca
Merge branch 'branch-Level-7'
liuzehui03 Mar 7, 2024
666aaa8
fix save function
liuzehui03 Mar 7, 2024
12b1ddd
JAR file
liuzehui03 Mar 7, 2024
09c7795
added Storage class
liuzehui03 Mar 7, 2024
ed304d3
added Ui class
liuzehui03 Mar 7, 2024
a5c5aed
added taskList and parser
liuzehui03 Mar 8, 2024
0612989
added find task feature
liuzehui03 Mar 8, 2024
2df056b
Revert "added find task feature"
liuzehui03 Mar 8, 2024
db07c45
find task feature
liuzehui03 Mar 8, 2024
f540c91
Merge pull request #1 from liuzehui03/branch-Level-9
liuzehui03 Mar 8, 2024
df0007c
fix some bugs
liuzehui03 Mar 8, 2024
6a14058
added comments
liuzehui03 Mar 8, 2024
8c65295
more comments
liuzehui03 Mar 8, 2024
84af7ed
Merge branch 'branch-A-JavaDoc'
liuzehui03 Mar 8, 2024
306396e
finallsing documentation READme
liuzehui03 Mar 8, 2024
674d503
updated link
liuzehui03 Mar 8, 2024
017bdec
no message
liuzehui03 Mar 8, 2024
302e239
no message
liuzehui03 Mar 8, 2024
5491c80
comment
liuzehui03 Mar 8, 2024
5fd1291
Merge remote-tracking branch 'origin/master'
liuzehui03 Mar 8, 2024
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
197 changes: 183 additions & 14 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,198 @@
# User Guide
# YOJ User Guide

## Features

### Feature-ABC
## Overview
YOJ is a CLI-based application that allows users to track their tasks. Users can
add and delete tasks from a list, mark them as Done or undone and view all current tasks. This user guide aims to
help users get familiarized with the different commands available in the application.

Description of the feature.

### Feature-XYZ
## Quick Start
1. Download Java11.
2. Download the latest JAR file from [here](https://github.com/liuzehui03/ip/releases/tag/A-Release).
3. Move the JAR file into an empty folder.
4. In the command terminal, use the `cd` command to switch to the
folder with the JAR file.
5. Enter `java -jar ip.jar` in the command terminal to run this application.
6. Refer to the features below for details of the various commands and how to use YOJ.

Description of the feature.

## Usage
## Features

### `Keyword` - Describe action

Describe the action and its outcome.
### Viewing all tasks: `list`

Example of usage:
Shows a list of all the current tasks, along with their
descriptions and status.

`keyword (optional arguments)`

Expected outcome:
Format: `list`

Description of the outcome.
Example of usage:

```
expected output
list
```

Expected output:
```
AGENDA ✉
♡ All the best!! 💕
_____________
1. [T][ ] add tasks
2. [D][ ] finish user guide (by: monday)
3. [E][X] project meeting (from: Mon 2pm to: 4pm)
```

### Adding a ToDo task: `todo`

Adds a ToDo task to the task list.

Format: `todo [description]`

Example of usage:

```
todo exercise
```

Expected output:
```
okii task added :
[T][ ] exercise
Now you have 1 tasks in the list
```

### Adding a Deadline task: `deadline`

Adds a Deadline task to the task list.

Format: `deadline [description] /by [deadline]`

Example of usage:

```
deadline return file /by monday
```

Expected output:
```
okii task added :
[D][ ] return file (by: monday)
Now you have 2 tasks in the list.
```

### Adding an Event task: `event`

Adds an Event task to the task list.

Format: `event [description] /from [eventStart] /to [eventEnd]`

Example of usage:

```
event project meeting /from Mon 2pm /to 4pm
```

Expected output:
```
okii task added :
[E][ ] project meeting (from: Mon 2pm to: 4pm)
Now you have 3 tasks in the list.
```

### Marking a task as done: `mark`

Changes the status of the selected task to Done.

Format: `mark [index]`

Example of usage:

```
mark 1
```

Expected output:
```
okiee! amazing!! I've marked this task as done:
[T][X] exercise
```

### Marking a task as undone: `unmark`

Changes the status of the selected task to Undone.

Format: `unmark [index]`

Example of usage:

```
unmark 1
```

Expected output:
```
alright I've marked this task as not done yet, do rmb to do it soon:
[T][ ] exercise
```


### Removing a task: `delete`

Removes a specific task from the task list.

Format: `delete [index]`

Example of usage:

```
delete 1
```
Expected output:
```
okiee i've deleted the task
[T][ ] exercise
Now you have 2 tasks in the list.
```

### Finding a task: `find`

Returns all tasks in the task list that contains the keyword.

Format: `find [keyword]`

Example of usage:

```
find assignment
```

Expected output:
```
🔍 here are the tasks found with the keyword!
1. [T][ ] assignment 3
2. [T][ ] review assignment 2
```

### Exiting the program: `bye`

Exits the application and saves all tasks in a file.

Format: `bye`

Example of usage:

```
bye
```


Expected output:
```
bye bye!! hope to see u soon :) 😊
```
Make sure to say bye to ensure your data is saved properly, otherwise YOJ might not remember the tasks

### Data Management
Data would be saved locally on your device upon usage of `bye`
3 changes: 3 additions & 0 deletions src/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: Yoj.Yoj

2 changes: 2 additions & 0 deletions src/main/data/Yojdata.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[T] | 0 | haha
[D] | 0 | bfwgr
10 changes: 0 additions & 10 deletions src/main/java/Duke.java

This file was deleted.

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

import Yoj.exception.InvalidCommandException;
import Yoj.exception.YojException;
import Yoj.parser.Parser;
import Yoj.storage.Storage;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Scanner;
import Yoj.taskList.List;
import Yoj.ui.*;


public class Yoj {
/**
* main method is the entry point for Yoj which handles user input and commands processing for the task management system.
*
* @param args Command-line arguments passed to the application.
* @throws YojException Custom exception for application-specific errors.
* @throws InvalidCommandException Custom exception for invalid commands entered by the user.
* @throws FileNotFoundException Exception thrown when the file with saved tasks is not found.
*
*/
public static void main(String[] args) throws YojException, InvalidCommandException, FileNotFoundException {
Ui.printHello();
// get user input
Scanner in = new Scanner(System.in);
List.tasks = Storage.loadTasks();
String userInput;
do {
userInput = in.nextLine();
try {
Parser.manageUserInput(userInput);
} catch (YojException e){
System.out.println(e.getMessage());
} catch (InvalidCommandException e) {
System.out.println(e.getMessage());
} catch (IOException e) {
throw new RuntimeException(e);
}
} while (!userInput.equals("bye"));
in.close();

}
}
6 changes: 6 additions & 0 deletions src/main/java/Yoj/exception/InvalidCommandException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package Yoj.exception;
public class InvalidCommandException extends Exception{
public InvalidCommandException(String message){
super(message);
}
}
6 changes: 6 additions & 0 deletions src/main/java/Yoj/exception/YojException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package Yoj.exception;
public class YojException extends Exception {
public YojException(String message) {
super(message);
}
}
48 changes: 48 additions & 0 deletions src/main/java/Yoj/parser/Parser.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package Yoj.parser;

import Yoj.taskList.List;
import Yoj.exception.InvalidCommandException;
import Yoj.exception.YojException;
import Yoj.storage.Storage;
import Yoj.ui.Ui;
import java.io.IOException;
import static Yoj.taskList.List.tasks;

/**
* This class is responsible for parsing the user input and managing the corresponding actions.
*/
public class Parser {
/**
* Parses the user input and invokes the appropriate action based on the command.
*
* @param userInput The full line of input entered by the user.
* @throws YojException If there's a problem specific to Yoj's functionality.
* @throws InvalidCommandException If the entered command is not recognized.
* @throws IOException If there is an input/output error during task handling.
*/
public static void manageUserInput(String userInput) throws YojException, InvalidCommandException, IOException {
if (userInput.equals("list")) {
Ui.printList();
} else if(userInput.matches("mark \\d+")) {
String[] taskIndex = userInput.split(" ");
int index = Integer.parseInt(taskIndex[1] );
tasks.get(index - 1).markDone();
Ui.markDoneMessage(index);
} else if(userInput.matches("unmark \\d+")) {
String[] taskIndex = userInput.split(" ");
int index = Integer.parseInt(taskIndex[1]);
tasks.get(index - 1).markUndone();
Ui.markUndoneMessage(index);
} else if(userInput.startsWith("todo") || userInput.startsWith("deadline") || userInput.startsWith("event")) {
List.addTask(userInput);
} else if(userInput.startsWith("delete")) {
List.deleteTask(userInput);
} else if(userInput.startsWith("find")) {
String description = userInput.substring("find ".length()).trim();
List.findTask(description);
} else if(userInput.equals("bye")){
Ui.byeMessage();
Storage.save(tasks);
} else throw new InvalidCommandException("unfortunately im not sure what u mean... :<");
}
}
Loading