diff --git a/docs/README.md b/docs/README.md index 47b9f984f7..2e1c0a5686 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,30 +1,220 @@ -# Duke User Guide +

Plato User Guide plato

-// Update the title above to match the actual product name +--- -// Product screenshot goes here +![This is the product](Ui.png) -// Product intro goes here +Plato is a desktop application for managing your everyday task, optimised with CLI-like(Command Line Interface) inputs, it +delivers a beautiful smart personal assistant to interact with. -## Adding deadlines -// Describe the action and its outcome. +# Table of Contents +1. [Features](#features) + 1. [Add Task](#add-task) + * [Todo](#todo) + * [Deadline](#deadline) + * [Event](#event) + * [Specification for DateTimeFormat](#specification-for-datetimeformat) + 2. [Manage Task](#manage-task) + 3. [Query Task](#query-task) + * [Find](#find) + * [View](#view) +2. [Save Information](#saving-the-data) +3. [Extra information](#credits) -// Give examples of usage +--- +# Features -Example: `keyword (optional arguments)` -// A description of the expected outcome goes here +## Add Task + +Adds a task to the current task list +There are three types of task you can add, todo, deadline and event. + +### Todo + +The todo task just contains a description of the task. +Usage: `todo [DESCRIPTION]` + +Examples: + +* `todo Cook Dinner` + +* `todo Read Book` + +Expected outcome: +``` +Got it. I've added this task: + [T][ ] Cook Dinner +Now you got 1 tasks in your list. +``` + +### Deadline + +The deadline task is a a todo task with a date to complete by. + +Usage: `deadline [DESCRIPTION] /by [DateTimeFormat]` + +**Refer to the section below for the specification of [DateTimeFormat]** + +Examples: + +* `deadline cs3230 /by 2359 23/02/2024` + +* `deadline cs2103 /by 23:59 23-02-24` + +Expected outcome: +``` +Got it. I've added this task: + [D][ ] cs3230 (by:23-02-2024 23:59) +Now you got 2 tasks in your list. +``` + +### Event + +The event task is a todo task that spans a period of time. + +Usage: +`event [DESCRIPTION] /from [DateTimeFormat] /to [DateTimeFormat]` + +**Refer to the section below for the specification of [DateTimeFormat]** + +Examples: + +* `event cs2103 planning /from 1800 24/02/24 /to 1900 27/02/24` + +* `event midterm study session /from 01:00pm 28-02-24 /to 02:00pm 30-02-24` + +Expected outcome: +``` +Got it. I've added this task: + [E][ ] cs2103 planning (from:23-02-2024 18:00) +Now you got 3 tasks in your list. +``` +### Specification for `[DateTimeFormat]` + +It comes in two parts `[DateFormats]` and `[TimeFormats]`. +`[TimeFormats]` can be omitted and Plato will assume the time to be midnight of that particular day. + +The order of the `[DateFormats]` and `[TimeFormats]` does not matter as long as a space between them to differentiate the two + +> If your [DateTimeFormat] is invalid, Plato will store them as normal strings instead ,this is to support a wider variety of users. +> This will affect the Query:view command later. + +Usage: +``` +[DateFormats] +[DateFormats] [TimeFormats] +[TimeFormats] [DateFormats] +``` + +Examples : +``` +12-04-24 1800 +03:30pm 15/03/2024 ``` -expected output + +Current acceptable **[DateFormats]** are : +``` +dd-mm-yy +dd/mm/yy +dd-mm-yyyy +dd/mm/yyyy +``` + +> [!NOTE] +> If the year used is 2 digits, Plato will assume the year in the current millennium + +Current acceptable **[TimeFormats]** in 12 or 24 hour formats are allowed as follows: +``` +HHMM +HH:MM +HH:MM[am/pm] +``` +> [!CAUTION] +> Time written in 12-hour format requires specifying am/pm. Otherwise, Plato will assume 24-hour format. + + +--- + +## Manage Task +You can modify existing task with unmark, mark, delete at the particular index. +Usages: ``` +umark [INDEX] +mark [INDEX] +delete [INDEX] +``` + +Examples: +``` +mark 1 +delete 3 +``` + +Expected outcome: +``` +Nice! I've marked this task as done: + [T][X] Cook dinner + +Noted. I've removed this task + [E][ ] cs2103 planning (from:23-02-2024 18:00) + Now you have 2 taks in the list +``` +--- + +## Query Task + +When you know specific information about task and you wish to find a specific task by their attributes. + +### Find + +Finds in the description of each task if it matches the keyword + +Usage: `find [KEYWORD]` + +### View + +View the all the task being scheduled on that date. + +Usage: `view [DateFormats]` + +**Refer to the section above for the specification of [DateFormat]** + +> If your [DateTimeFormat] is invalid when adding the task, Plato will not show them in the results when you try to search for it. + +Examples: +``` +find Cook +view 23-02-24 +``` + +Expected outcome: +``` +Here are the matching task in your list: + 1. [T][X] Cook dinner + +Here are the task scheduled on that date: + 1. [E][ ] cs2103 planning (from:23-02-2024 18:00) + ``` + +--- + +# Saving the data + +Plato's data are saved in the hard disk automatically at an fixed interval. There is no need to save manually. + +--- + +# Editing the data file -## Feature ABC +Plato's data are saved automatically as a .txt file `[JAR file location]/data/tasks.txt`. Advanced users are welcome to update or import their own data. -// Feature details +> [!WARNING] +> If your file changes to data file is of an invalid format. Plato will flush out the old data and start afresh. -## Feature XYZ +# Credits +All images used are artworks of my own! -// Feature details \ No newline at end of file diff --git a/docs/Ui.png b/docs/Ui.png new file mode 100644 index 0000000000..6203fcbd19 Binary files /dev/null and b/docs/Ui.png differ diff --git a/docs/headerIcon.png b/docs/headerIcon.png new file mode 100644 index 0000000000..398675d556 Binary files /dev/null and b/docs/headerIcon.png differ diff --git a/src/main/java/plato/parser/DateHandler.java b/src/main/java/plato/parser/DateHandler.java index 30eea08df6..6bc908ab81 100644 --- a/src/main/java/plato/parser/DateHandler.java +++ b/src/main/java/plato/parser/DateHandler.java @@ -61,6 +61,11 @@ public static Optional checkDate(String testDate) throws PlatoExcepti * @return An Optional that contains LocalTime if it exists. */ public static Optional checkTime(String testTime) throws PlatoException { + //Remove the date so that it is easier to check for the time, and prevent conflicts + Matcher removeDate = PATTERN_DATE.matcher(testTime); + if (removeDate.find()) { + testTime = testTime.replaceAll(removeDate.group(), ""); + } Matcher match = TIME_PATTERN.matcher(testTime); Matcher am = Pattern.compile("(?i)[ap]m").matcher(testTime); diff --git a/src/main/java/plato/task/Event.java b/src/main/java/plato/task/Event.java index f245f20b6c..ec9fb66cb7 100644 --- a/src/main/java/plato/task/Event.java +++ b/src/main/java/plato/task/Event.java @@ -70,7 +70,7 @@ public String toString() { if (byDateTime == null) { return "[E]" + super.toString() + " (from: " + from + " to " + by + ")"; } else { - return "[E]" + super.toString() + " (from: " + DateHandler.formatDate(fromDateTime) + " to " + return "[E]" + super.toString() + " (from: " + DateHandler.formatDate(fromDateTime) + " to: " + DateHandler.formatDate(byDateTime) + ")"; } } diff --git a/src/main/java/plato/task/TaskManager.java b/src/main/java/plato/task/TaskManager.java index 948cc990ba..5d4037f2e8 100644 --- a/src/main/java/plato/task/TaskManager.java +++ b/src/main/java/plato/task/TaskManager.java @@ -26,8 +26,8 @@ public class TaskManager { private static final String RESPONSE_UMARK = "OK, I've marked this task as not done yet:"; private static final String RESPONSE_REMOVE = "Noted. I've removed this task"; private static final String RESPONSE_ADD = "Got it. I've added this task:"; - private static final String RESPONSE_FIND = "Here are the matching tasks in your list"; - private static final String RESPONSE_VIEW_DATES = "Here are the task scheduled on that date!!"; + private static final String RESPONSE_FIND = "Here are the matching tasks in your list: "; + private static final String RESPONSE_VIEW_DATES = "Here are the task scheduled on that date: "; private static final String RESPONSE_EMPTY = "You have no tasks!!!! Add something to do you peasant!! "; private static final String RESPONSE_EMPTY_SEARCH = "Sorry I couldn't find anything that fits that search :("; diff --git a/src/test/java/plato/parser/DateHandlerTest.java b/src/test/java/plato/parser/DateHandlerTest.java index 6c679a22a5..368af09353 100644 --- a/src/test/java/plato/parser/DateHandlerTest.java +++ b/src/test/java/plato/parser/DateHandlerTest.java @@ -20,4 +20,9 @@ public void check_date_success() throws PlatoException { public void checkTime_success() throws PlatoException { assertEquals(LocalTime.of(18, 0), DateHandler.checkTime("1800 12-04-23").orElse(LocalTime.of(0, 0))); } + + @Test + public void checkTime_dateyearfull_success() throws PlatoException { + assertEquals(LocalTime.of(23, 59), DateHandler.checkTime("2359 15/02/2024").orElse(LocalTime.of(0, 0))); + } }