From 1d6ed65d6e954cff4052967eb34c1a7b4ea1661c Mon Sep 17 00:00:00 2001 From: loose-bus-change Date: Mon, 20 Sep 2021 15:41:33 +0800 Subject: [PATCH] Add User guide --- data/duke.txt | 7 +- docs/README.md | 224 +++++++++++++++++++++++++++++++-- src/main/java/duke/Parser.java | 22 ++-- 3 files changed, 229 insertions(+), 24 deletions(-) diff --git a/data/duke.txt b/data/duke.txt index 0b96888156..db564104c7 100644 --- a/data/duke.txt +++ b/data/duke.txt @@ -1,2 +1,5 @@ -[D][ ] return book by: 2021-12-02 18:00 -[D][X] read book by: 2021-10-15 18:00 +[T][ ] read book +[E][ ] project meeting at: 2021-10-15 19:00 +[E][ ] make pasta at: 2021-08-16 13:00 +[D][ ] submit ip by: 2021-08-16 23:59 +[E][ ] attend party at: 2022-03-07 15:00 diff --git a/docs/README.md b/docs/README.md index 8077118ebe..44cb8b9918 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,29 +1,229 @@ # User Guide +Duke is a **desktop app** for _managing tasks_ and having the benefits of a Graphical User Interface (GUI). +You can add 3 types of tasks (Todo, Deadline, Event) and use a whole range of features to manage those tasks. + +-------------------------------------------------------------------------------------------------------------------- + +## Quick start + +1. Ensure you have Java `11` or above installed in your Computer. + +1. Download the latest `duke.jar` from [here](https://github.com/se-edu/addressbook-level3/releases). + +1. Copy the file to the folder you want to use as the _home folder_ for your Duke. + +1. Double-click the file to start the app. + +1. Type the command in the popup and press **Send** to execute it. + +1. Refer to the [Features](#features) below for details of each command. + +-------------------------------------------------------------------------------------------------------------------- + ## Features -### Feature-ABC +### Add Todo Task + +Have a task that does not have a deadline ? Use this feature to add a **Todo** task. + +#### `todo ` - add a todo task + +Example of usage: + +`todo read book` + +Here is the output you should see from Duke: + +``` +Got it! I've added this task: +[T][ ] read book +Now you have 1 task(s) in the list. +``` + +### Add Deadline Task + +Have a task that is due by a particular date and time ? Use this feature to add a **Deadline** task. + +#### `deadline /by ` - add a deadline task + +Example of usage: + +`deadline return book /by 2/12/2021 1800` + +Here is the output you should see from Duke: + +``` +Got it! I've added this task: +[D][ ] return book by: 2021-12-02 18:00 +Now you have 2 task(s) in the list. +``` + +### Add Event Task + +Have an event that happens at a particular time ? Use this feature to add an **Event** task. + +#### `event /at ` - add an event task + +Example of usage: + +`event project meeting /at 15/10/2021 1900` + +Here is the output you should see from Duke: + +``` +Got it! I've added this task: +[E][ ] project meeting at: 2021-10-15 +Now you have 3 task(s) in the list. +``` + +### Mark as done + +Finished with a task ? Yay! You can use this feature to indicate that you have finished the task. + +#### `done ` - to indicate you are done with a task + +Example of usage: + +`done 2` + +Here is the output you should see from Duke: + +``` +Nice! I've marked this task as done: +[X] return book +``` + +### View Task List + +Use this feature to view the current list of tasks that you have. + +#### `list` - to view list of tasks -Description of the feature. +Example of usage: -### Feature-XYZ +`list` -Description of the feature. +Here is the output you should see from Duke: -## Usage +``` +Here are the tasks in your list: +1. [T][ ] read book +2. [D][X] return book by: 2021-12-02 18:00 +3. [E][ ] project meeting at: 2021-10-15 +``` -### `Keyword` - Describe action +### Search by keyword -Describe the action and its outcome. +Struggling to find a particular task ? Use this feature to search for a task by using a keyword -Example of usage: +#### `find ` - add a todo task -`keyword (optional arguments)` +Example of usage: -Expected outcome: +`find meeting` -Description of the outcome. +Here is the output you should see from Duke: ``` -expected output +[E][ ] project meeting at: 2021-10-15 ``` + +### Delete a task + +Use this feature to remove a task from the list. + +#### `delete ` - delete a particular task + +Example of usage: + +`delete 2` + +Here is the output you should see from Duke: + +``` +Noted. I've removed this task: +[D][X] return book by: 2021-12-02 18:00 +Now you have 2 task(s) in your list +``` + +### Get schedule + +Want to get a schedule of your tasks. Use this feature to get tasks in three different ways. + +Here is a sample task list to demonstrate this feature: +``` +[T][ ] read book +[E][ ] project meeting at: 2021-10-15 19:00 +[E][ ] make pasta at: 2021-08-16 13:00 +[D][ ] submit ip by: 2021-08-16 23:59 +[E][ ] attend party at: 2022-03-07 15:00 +``` + +#### `schedule on ` - get the list of tasks on a particular date + +Example of usage: + +`schedule on 16/08/2021` + +Here is the output you should see from Duke: + +``` +Here are the list of tasks scheduled on 16/08/2021: +1. [E][ ] make pasta at: 2021-08-16 13:00 +2. [D][ ] submit ip by: 2021-08-16 23:59 +``` +#### `schedule until ` - get the list of tasks until a particular date + +Example of usage: + +`schedule until 16/12/2021` + +Here is the output you should see from Duke: + +``` +Here are the list of tasks scheduled until 16/12/2021: +1. [E][ ] project meeting at: 2021-10-15 19:00 +2. [E][ ] make pasta at: 2021-08-16 13:00 +3. [D][ ] submit ip by: 2021-08-16 23:59 +``` + +#### `schedule after ` - get the list of tasks after a particular date + +Example of usage: + +`schedule after 16/08/2021` + +Here is the output you should see from Duke: + +``` +Here are the list of tasks scheduled after 16/08/2021: +1. [E][ ] project meeting at: 2021-10-15 19:00 +2. [E][ ] attend party at: 2022-03-07 15:00 +``` + +**Important Note:** you can also enter your dates in the following formats: +* d/m/yyyy +* dd/m/yyyy +* d/mm/yyyy + +### Help + +If you ever forget the format for the commands or want to refresh your memory on what commands are available, use this feature to have Duke remind you! + +#### `help` - get a list of Duke command formats + +## Command summary + +Action | Format, Examples +--------|------------------ +**Add Todo Task** | `todo `
e.g., `todo read book` +**Add Deadline Task** | `deadline /by `
e.g., `deadline return book /by 2/12/2021 1800` +**Add Event Task** | `event /at `
e.g., `event project meeting /at 16/08/2021 1900` +**Find Task** | `find `
e.g., `find book` +**Delete Task** | `delete `
e.g., `delete 2` +**Schedule On** | `schedule on `
e.g., `schedule on 16/08/2021` +**Schedule Until** | `schedule until `
e.g., `schedule until 16/08/2021` +**Schedule After** | `schedule after `
e.g., `schedule after 16/08/2021` +**Show Task List** | `list` +**Help** | `help` diff --git a/src/main/java/duke/Parser.java b/src/main/java/duke/Parser.java index 5f697fab69..9cac44270b 100644 --- a/src/main/java/duke/Parser.java +++ b/src/main/java/duke/Parser.java @@ -101,9 +101,9 @@ public static String parseTodoCommand(String input, TaskList t, Storage s) { String firstTodo = input.substring(5); t.addTodo(firstTodo); s.appendListToFile(t); - returnString = returnString + "Got it. I've added this task: " + "\n"; + returnString = returnString + "Got it! I've added this task: " + "\n"; returnString = returnString + new Todo(firstTodo).toString() + "\n"; - returnString = returnString + "Now you have " + t.size() + " tasks in the list" + "\n"; + returnString = returnString + "Now you have " + t.size() + " task(s) in the list" + "\n"; return returnString; } } @@ -125,9 +125,9 @@ public static String parseDeadlineCommand(String input, TaskList t, Storage s) { LocalDateTime deadlineDate = getDate(wordsInTaskDescription, timeString); t.addDeadline(deadlineDescription, deadlineDate); s.appendListToFile(t); - returnString = returnString + "Got it. I've added this task: " + "\n"; + returnString = returnString + "Got it! I've added this task: " + "\n"; returnString = returnString + new Deadline(deadlineDescription, deadlineDate).toString() + "\n"; - returnString = returnString + "Now you have " + t.size() + " tasks in the list" + "\n"; + returnString = returnString + "Now you have " + t.size() + " task(s) in the list" + "\n"; return returnString; } } @@ -148,9 +148,9 @@ public static String parseEventCommand(String input, TaskList t, Storage s) { String eventDescription = wordsInEventDescription[0].substring(6); LocalDateTime eventDate = getDate(wordsInEventDescription, timeString); t.addEvent(eventDescription, eventDate); - returnString = returnString + "Got it. I've added this task: " + "\n"; + returnString = returnString + "Got it! I've added this task: " + "\n"; returnString = returnString + new Event(eventDescription, eventDate).toString() + "\n"; - returnString = returnString + "Now you have " + t.size() + " tasks in the list" + "\n"; + returnString = returnString + "Now you have " + t.size() + " task(s) in the list" + "\n"; s.appendListToFile(t); return returnString; } @@ -175,7 +175,7 @@ public static String parseDeleteCommand(String input, TaskList t, Storage s) { t.delete(taskIndex - 1); returnString = returnString + "Noted. I've removed this task: " + "\n"; returnString = returnString + removedTask.toString() + "\n"; - returnString = returnString + "Now you have " + t.size() + " tasks in the list" + "\n"; + returnString = returnString + "Now you have " + t.size() + " task(s) in the list" + "\n"; s.appendListToFile(t); return returnString; } @@ -191,7 +191,7 @@ public static String parseFindCommand(String input, TaskList t) { String returnString = ""; int count = 0; for (Task task : t.getTaskList()) { - String taskDescription = task.description.substring(0, task.description.length() - 4); + String taskDescription = task.description.substring(0, task.description.length()); String[] wordsInTaskDescription = taskDescription.split(" "); for (String str : wordsInTaskDescription) { if (str.equals(keyword)) { @@ -231,10 +231,12 @@ public static LocalDateTime getDate(String[] tempEvent, String time) { String year = splitDateComponents[2]; String month = splitDateComponents[1]; String currentDate = splitDateComponents[0]; - int dateInteger = Integer.parseInt(currentDate); - if (dateInteger < 10) { + if (currentDate.length() == 1) { currentDate = "0" + currentDate; } + if (month.length() == 1) { + month = "0" + month; + } String finalDateFormat = year + "-" + month + "-" + currentDate; String finalDateTimeFormat = finalDateFormat + " " + time; DateTimeFormatter datePattern = DateTimeFormatter.ofPattern("yyyy-MM-dd HHmm");