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

Release #324

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
6 changes: 6 additions & 0 deletions data/duke.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
T | true | eat |
E | false | meeting | 1pm
D | false | test | 3pm
E | false | dinner | 6pm
D | true | wakeup | today
T | false | live |
161 changes: 153 additions & 8 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,165 @@
# User Guide
# User Guide

## Features

### Feature 1
Description of feature.
### 1. Add Todo
Add a todo task to your task list.

### 2. Add Deadline
Add a deadline task to your task list with relevant time.

### 3. Add Event
Add an event to your task list with relevant time.

### 4. Mark task as Done
Mark a task in your task list as done.

### 5. List all tasks
List out all tasks in your task list in order.

### 6. Delete task
Delete a task from your task list.

### 7. Find task
Find tasks containing any form of a keyword.

### 8. Save task list
Save your task list to a .txt file.



## Usage

### `Keyword` - Describe action
### Loading from txt file
When the Program is started, it automatically looks for its backup file at data/duke.txt. If it is not found it will be created.

**Example of usage:**
No previous backup found:

File not found. New file created
File loaded successfully.
Backup found, writing to backup:

File loaded successfully.

list

Here are the tasks in your list:
1. [T][✓] read book
2. [E][✘] meeting (10am)
3. [D][✘] Assignment 2 (Monday 2359)

### `todo <task description>` - Add a Todo task

Add a Todo task to your task list.

Example of usage:

`todo read book`

Expected outcome:


Got it. I've added this task:
[T][✗] read book`
Now you have 1 tasks in the list.


### `event <task description> /at <date>` - Add an Event

Add an Event task to your task list with relevant time.

Example of usage:

event meeting /10am

Expected outcome:
Got it. I've added this task:
[E][✘] meeting (10am)
Now you have 2 tasks in the list.


### `deadline <task description> /by <date>` - Add a Deadline

Add a Deadline task to your task list.

Example of usage:

`deadline Assignment 2 /Monday 2359`

Expected outcome:

Got it. I've added this task:
[D][✗] Assignment 2 (Monday 2359)
Now you have 3 tasks in the list.

### `done <task index>` - Mark task as done

Mark a task in your task list as done.

Example of usage:

done 1

Expected outcome:

Nice! I've marked this task as done:
[T][✓] read book

### `list` - List all tasks

List all tasks in your task list.

Example of usage:

`list`

Expected outcome:


Here are the tasks in your list:
1. [T][✓] read book
2. [E][✘] meeting (10am)
3. [D][✘] Assignment 2 (Monday 2359)

### `delete <task index>` - Delete a task

Delete a task from your task list.

Example of usage:

`delete 1`

Expected outcome:


Removed: [T][✓] read book
Now you have 2 task(s) in your list


### `find <keyword>` - Find tasks

Find tasks with matching keyword. Even tasks that have different workings than the keywork can turn up.

Example of usage:

find read

Expected outcome:

Here are the matching tasks in your list:
1. [D][✘] Go through lecture readings (Tuesday before lecture)
2. [E][✘] I hate reading (Tuesday 10pm)


### `save` - Save task list

Describe action and its outcome.
Save task list to .txt file.

Example of usage:
Example of usage:

`keyword (optional arguments)`
`save`

Expected outcome:

`outcome`
Successfully saved to file!
21 changes: 21 additions & 0 deletions src/main/java/Command/ByeCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package Command;

import Storage.Storage;
import TaskManager.TaskManager;
import Ui.Ui;

import java.io.IOException;

public class ByeCommand extends Command {
@Override
public void executeCommand(TaskManager taskManager, Ui ui, Storage storage) {

ui.bidGoodbye();
storage.saveToFile(taskManager.getTasks());
}

@Override
public boolean isExit(){
return true;
}
}
13 changes: 13 additions & 0 deletions src/main/java/Command/Command.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package Command;

import Storage.Storage;
import Ui.Ui;
import TaskManager.TaskManager;

public abstract class Command {

public abstract void executeCommand(TaskManager taskManager, Ui ui, Storage storage);
public boolean isExit(){
return false;
}
}
20 changes: 20 additions & 0 deletions src/main/java/Command/DeleteTaskCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package Command;


import Storage.Storage;
import TaskManager.TaskManager;
import Ui.Ui;

public class DeleteTaskCommand extends Command{
private final String index;

public DeleteTaskCommand(String index){
this.index = index;
}

@Override
public void executeCommand(TaskManager taskManager, Ui ui, Storage storage) {
int num = Integer.parseInt(index);
TaskManager.Delete(num);
}
}
20 changes: 20 additions & 0 deletions src/main/java/Command/DoneCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package Command;

import Storage.Storage;
import Ui.Ui;
import TaskManager.TaskManager;

public class DoneCommand extends Command {
private final int index;

public DoneCommand(String index)
{
int num = Integer.parseInt(index);
this.index = num;
}

@Override
public void executeCommand(TaskManager taskManager, Ui ui, Storage storage) {
taskManager.markDone(index);
}
}
23 changes: 23 additions & 0 deletions src/main/java/Command/FindCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package Command;

import Storage.Storage;
import TaskManager.TaskManager;
import Ui.Ui;

import java.io.IOException;

public class FindCommand extends Command{
private final String description;

public FindCommand(String description)
{
this.description = description;

}

@Override
public void executeCommand(TaskManager taskManager, Ui ui, Storage storage) {
TaskManager.Find(description);
}
}

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

import Storage.Storage;
import Ui.Ui;
import TaskManager.TaskManager;


public class ListCommand extends Command{
@Override
public void executeCommand(TaskManager taskManager, Ui ui, Storage storage){
taskManager.printList();
}
}

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

import Storage.Storage;
import TaskManager.TaskManager;
import Ui.Ui;

public class NewTaskCommand extends Command {
private final String taskType;
private final String taskDescription;

public NewTaskCommand(String taskType, String taskDescription) {
this.taskType = taskType;
this.taskDescription = taskDescription;
}

@Override
public void executeCommand(TaskManager taskManager, Ui ui, Storage storage){
taskManager.addTask(taskType, taskDescription);
}
}
13 changes: 13 additions & 0 deletions src/main/java/Command/SaveCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package Command;

import Storage.Storage;
import Ui.Ui;
import TaskManager.TaskManager;


public class SaveCommand extends Command{
@Override
public void executeCommand(TaskManager taskManager, Ui ui, Storage Storage) {
Storage.saveToFile(taskManager.getTasks());
}
}
Loading