From ce0c8070a14c491a7a4102f5e73427a54dc9a9a6 Mon Sep 17 00:00:00 2001 From: GraceZhuXY Date: Wed, 1 Mar 2023 13:14:58 +0800 Subject: [PATCH] Add user guide --- docs/README.md | 135 ++++++++++++++++++++++++++++++++++---- src/main/java/Parser.java | 9 ++- src/main/java/Ui.java | 7 +- 3 files changed, 133 insertions(+), 18 deletions(-) diff --git a/docs/README.md b/docs/README.md index 8077118eb..ea3693e81 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,29 +1,138 @@ -# User Guide +# Duke: User Guide + +Duke is a personal assistant chatbot that is designed to keep track of various tasks using a Command Line Interface. + +## Quick start + +``` +Loading previously saved data... + +Hi, I'm Duke! +What's up? +``` + +1. Ensure you have Java 11 or above installed in your Computer. +2. Download the latest `Duke.jar` from the Releases page. +3. Copy the file into the desired folder. +4. Using a command terminal, navigate into the folder, and run the command `java -jar Duke.jar`. You should see the above welcome message displayed. Note that Duke may load data from previously saved tasks first. +5. Type in a command and press Enter to execute it. ## Features -### Feature-ABC +### Command format + +* Words in `UPPER_CASE` are parameters supplied by the user. e.g. in `todo TASK_DESCRIPTION`, `TASK_DESCRIPTION` is a parameter which can be used as `todo make coffee`. +* Parameters must be specified in the order indicated. + +### Available commands + +#### Adding a todo task: `todo` + +Adds a todo task to the task list. + +Format: `todo TASK_DESCRIPTION` -Description of the feature. +Examples: +* `todo homework` +* `todo make coffee` -### Feature-XYZ +#### Adding a deadline task: `deadline` -Description of the feature. +Adds a deadline task to the task list, which includes a specified end timing. -## Usage +Format: `deadline TASK_DESCRIPTION /by END_TIMING` -### `Keyword` - Describe action +Examples: +* `deadline assignment submission /by 2359` +* `deadline project work /by sometime next week` -Describe the action and its outcome. +#### Adding an event task: `event` -Example of usage: +Adds an event task to the task list, which includes a specified start and end timing. -`keyword (optional arguments)` +Format: `event TASK_DESCRIPTION /from START_TIMING /to END_TIMING` -Expected outcome: +Examples: +* `event lecture /from 1200 /to 1400` +* `event holidays /from today /to hopefully forever` -Description of the outcome. +#### Listing all tasks: `list` +Lists all available tasks, including task from previous saved data which have not been deleted. + +Format: `list` + +Example output: ``` -expected output +Here are your current tasks: +1.[T][ ] make coffee +2.[D][ ] assignment submission (by: 2359) +3.[E][ ] lecture (from: 1200 to: 1400) ``` + +#### Marking a task as done: `mark` + +Marks a task as complete given its current index on the tasklist. + +Format: `mark TASKLIST_INDEX` + +Example: +* `mark 1` + +#### Marking a task as not done: `unmark` + +Marks a task as incomplete given its current index on the tasklist. + +Format: `unmark TASKLIST_INDEX` + +Example: +* `unmark 1` + +#### Finding tasks: `find` + +Finds all matching tasks given a keyword. + +Format: `find KEYWORD` + +Example input: +`find coffee` + +Example output: +``` +Here are the matching tasks in your list: +1.[T][ ] iced coffee +2.[T][ ] hot coffee +``` + +#### Deleting a task: `delete` + +Deletes a task given its current index on the tasklist. + +Format: `delete TASKLIST_INDEX` + +Example input: +`delete 1` + +Example output: +``` +Got it! This task will be removed: +[T][ ] coffee +Number of tasks left: 2 +``` + +#### Exiting the program: `bye` + +Exits the program, and writes the remaining tasks into `./data/duke.txt` to be loaded the next time the program is opened. + +Format: `bye` + +Example output: +``` +Bye! :D +``` + +## FAQ + +Q: Is it possible to transfer data between devices? + +A: Data from a device is saved under the folder `./data/duke.txt`. To access this data on another device, download `Duke.jar` on the new device, and place `duke.txt` in the same directory. \ No newline at end of file diff --git a/src/main/java/Parser.java b/src/main/java/Parser.java index 6656494d6..84f5ea708 100644 --- a/src/main/java/Parser.java +++ b/src/main/java/Parser.java @@ -56,8 +56,13 @@ public static void parseCommand(String taskInfo, ArrayList tasks) { /** Prints list of all tasks */ public static void getList(ArrayList tasks) { - for (int i = 0; i < tasks.size(); i++) { - System.out.println((i + 1) + "." + Ui.printTask(tasks.get(i))); + if (tasks.size() > 0) { + System.out.println("Here are your current tasks:"); + for (int i = 0; i < tasks.size(); i++) { + System.out.println((i + 1) + "." + Ui.printTask(tasks.get(i))); + } + } else { + System.out.println("There are no current tasks (yay!)"); } } diff --git a/src/main/java/Ui.java b/src/main/java/Ui.java index 2924c1b63..26fa3c17b 100644 --- a/src/main/java/Ui.java +++ b/src/main/java/Ui.java @@ -4,12 +4,13 @@ public class Ui { /** Display message when loading previously saved tasks */ static void loadDataMessage() { - System.out.println(("Loading previous save data...")); + System.out.println("Loading previously saved data..."); + System.out.println(); } static void welcomeMessage() { - System.out.println("Hi, I'm bob"); - System.out.println("What's up"); + System.out.println("Hi, I'm Duke!"); + System.out.println("What's up?"); } static void goodbyeMessage() {