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

[Rachel Keh] iP #190

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
bc6ca22
Add Level 0 - Greet increment.
rachelkeh Aug 21, 2021
d5cc733
Add Level 1 - Greet, Echo, Exit increment.
rachelkeh Aug 26, 2021
99b3f51
Add Level 2 - Add, List increment.
rachelkeh Aug 26, 2021
8309681
Add Level 3 - Mark as Done increment.
rachelkeh Aug 26, 2021
08a1345
Change the convert to lower case to ignore case.
rachelkeh Aug 26, 2021
bbdf2ae
Add Level 4 - ToDos, Events, Deadlines increment.
rachelkeh Sep 1, 2021
67fabef
Shift welcome and bye messages in main into their own respective func…
rachelkeh Sep 2, 2021
13de32b
Add Level 5 - Handle Errors increment.
rachelkeh Sep 8, 2021
399b3d5
Refactor parts of the code to make the code neater.
rachelkeh Sep 9, 2021
1843230
Merge branch 'branch-Level-5'
rachelkeh Sep 9, 2021
f237497
Add A-Packages increment.
rachelkeh Sep 9, 2021
c5d42fa
Merge branch 'branch-A-Packages'
rachelkeh Sep 9, 2021
74b4662
Add Level 6 - Handle Delete increment.
rachelkeh Sep 16, 2021
8f3df6e
Add Level 7 - Save increment.
rachelkeh Sep 16, 2021
efbf58a
Merge branch 'branch-Level-6'
rachelkeh Sep 16, 2021
03e888b
Merge branch 'branch-Level-7'
rachelkeh Sep 16, 2021
a7141bb
Add A-MoreOOP - Use More OOP increment.
rachelkeh Sep 29, 2021
bc00250
Add Level 9 - Find increment.
rachelkeh Sep 29, 2021
3e70c07
Add A-JavaDoc - JavaDoc increment.
rachelkeh Sep 30, 2021
66de53c
Merge pull request #1 from rachelkeh/branch-Level-9
rachelkeh Sep 30, 2021
2bc7add
Merge branch 'master' into branch-A-JavaDoc
rachelkeh Sep 30, 2021
4d90ec4
Merge pull request #2 from rachelkeh/branch-A-JavaDoc
rachelkeh Sep 30, 2021
ad16726
Add help function and image used in the User Guide on GitHub.
rachelkeh Sep 30, 2021
033c0c8
Update README.md
rachelkeh Sep 30, 2021
c0c6052
Update README.md
rachelkeh Sep 30, 2021
764b0be
Update README.md
rachelkeh Sep 30, 2021
0b31ad7
Update README.md
rachelkeh Sep 30, 2021
f4839bf
Update README.md
rachelkeh Jul 6, 2022
3df36f7
Merge pull request #9 from rachelkeh/test
rachelkeh Jul 6, 2022
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
Binary file added IP.jar
Binary file not shown.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
asdsdsd
# Duke project template

This is a project template for a greenfield Java project. It's named after the Java mascot _Duke_. Given below are instructions on how to use it.
Expand Down
2 changes: 2 additions & 0 deletions data/duke.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
E | false | attend tutorial | Aug 6th 2-4pm
T | false | do geh tutorial
211 changes: 195 additions & 16 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,208 @@
# User Guide
Duke is a Personal Assistant ChatBot that helps a
person to keep track of various things via a Command Line Interface (CLI).
* Quick Start
* Features
* Viewing help
* Adding a Todo Task
* Adding a Deadline Task
* Adding an Event Task
* Listing all Tasks
* Marking a Task as done
* Deleting a Task
* Finding Tasks
* Exiting the program
* FAQ
* Command Summary

## Features

### Feature-ABC
## Quick Start
1. Ensure that you have [Java 11](https://docs.aws.amazon.com/corretto/latest/corretto-11-ug/downloads-list.html) or above installed in your computer.
2. Download the latest `IP.jar` file from here (add link after released).
3. Copy the file to the folder you want to use as the home folder for your ChatBot.
4. Write the following line of code to start the application.
```
java -jar IP.jar
```
5. On startup, you should see a terminal output similar to below.
![](https://github.com/rachelkeh/ip/blob/master/docs/ip%20jar%20screenshots/1.JPG)
6. Type a command and press Enter to execute it.
Some example commands you can try:
* `help`: Lists all the performable commands.
* `list`: Lists all tasks.
* `todo return book`: Adds a Todo task called `return book` into the task list.
* `done 1`: Marks the first task in the task list as done.
* `delete 3`: Deletes the third task in the task list.
* `bye`: Exits the application.

Description of the feature.
## Features
**Note about the command formats:**
* Extraneous parameters for commands with only one parameter (such as `help` `list` and `bye`) will be ignored.
> `help me` will be interpreted as `help`.

### Feature-XYZ
### Viewing Help
Lists all the valid commands that Duke accepts.\
Format: `help`\
Example:
```
help
```
Expected output:
```
_____________________________________________________________________________
Here are the performable actions:
1. Add a new To Do by typing "todo {content of your to do}".
2. Add a new Deadline by typing "deadline {content of your deadline} /by {date of deadline}".
3. Add a new Event by typing "event {content of your event} /at {date of event}".
4. Mark a task as done by typing in "done" and the index of the task on the list.
5. Check all the tasks you have added by typing in "list". Done tasks will be marked with an X.
6. Delete a task by typing in "delete" and the index of the task on the list.
7. Find a task with a particular keyword by typing in "find {keyword}". Tasks with that keyword will be listed.
8. Show this list of performable actions again by typing "help".
9. End the program by typing in "bye".
_____________________________________________________________________________
```
### Adding a Todo Task
Adds the most basic task type to the task list.\
Format: `todo <TASK_DESCRIPTION>`\
Example:
````
todo return book
````
Expected output:
````
_____________________________________________________________________________
Got it. I've added this task:
[T][ ] return book
Now you have 3 tasks in the list.
_____________________________________________________________________________
````

Description of the feature.
### Adding a Deadline Task
Adds a task that should be completed before a time specified by the user.\
Format: `deadline <TASK_DESCRIPTION> /by <TIME>`
* The command must be formatted this way, with the `/by` in between `<TASK_DESCRIPTION>` and `<TIME>`.\
Example:
````
deadline return book /by Aug 6th
````
Expected output:
````
_____________________________________________________________________________
Got it. I've added this task:
[D][ ] return book (by: Aug 6th)
Now you have 5 tasks in the list.
_____________________________________________________________________________
````

## Usage
### Adding an Event Task
Adds a task with a duration that starts and ends at a specific time.\
Format: `event <TASK_DESCRIPTION> /at <DURATION>`
* The command must be formatted this way, with the `/at` in between `<TASK_DESCRIPTION>` and `<DURATION>`.\
Example:
````
event attend tutorial /at Aug 6th 2-4pm
````
Expected output:
````
_____________________________________________________________________________
Got it. I've added this task:
[E][ ] attend tutorial (at: Aug 6th 2-4pm)
Now you have 6 tasks in the list.
_____________________________________________________________________________
````

### `Keyword` - Describe action
### Listing all Tasks
Shows a list of all the tasks in the task list.\
Format: list\
Example:
````
list
````
Expected output:
````
_____________________________________________________________________________
Here are the tasks in your list:
1.[D][ ] return book (by: Aug 6th)
2.[E][ ] attend tutorial (at: Aug 6th 2-4pm)
_____________________________________________________________________________
````

Describe the action and its outcome.
### Marking a Task as Done
Marks a task as completed.\
Format: `done <TASK_NUMBER>`
* `<TASK_NUMBER>` corresponds to the index number of the task on the task list when listed using `list`.\
Example:
````
done 1
````
Expected output:
````
_____________________________________________________________________________
Nice! I've marked this task as done:
[D][X] return book (by: Aug 6th)
_____________________________________________________________________________
````

Example of usage:
### Deleting a Task
Deletes a task.\
Format: `delete <TASK_NUMBER>`
* `<TASK_NUMBER>` corresponds to the index number of the task on the task list when listed using `list`.\
Example:
````
delete 1
````
Expected output:
````
_____________________________________________________________________________
Noted. I've removed this task:
[D][X] return book (by: Aug 6th)
Now you have 1 tasks in the list.
_____________________________________________________________________________
````

`keyword (optional arguments)`
### Finding Task(s)
Finds task(s) with a specified keyword.\
Format: find <KEYWORD>\
Example:
````
find tutorial
````
Expected output:
````
_____________________________________________________________________________
Here are the matching tasks in your list:
1.[E][ ] attend tutorial (at: Aug 6th 2-4pm)
2.[T][ ] do geh tutorial
_____________________________________________________________________________
````

Expected outcome:
### Exiting the program
Exits the ChatBot.\
Format: `bye`\
Example:
````
bye
````
Expected output:
````
_____________________________________________________________________________
Bye. Hope to see you again soon!
_____________________________________________________________________________
````

Description of the outcome.
## FAQ
*Q:* How do I transfer my data from my computer to another computer?\
*A:* Copy over the `IP.jar` file and `data` folder containing the `duke.txt` file that are within the same directory.

```
expected output
```
## Command Summary
Command | Action
------------ | -------------
Help | Lists all the valid commands that Duke accepts.
Todo | Adds the most basic task type to the task list.
Deadline | Adds a task that should be completed before a time specified by the user.
Event | Adds a task with a duration that starts and ends at a specific time.
List | Shows a list of all the tasks in the task list.
Done | Marks a task as completed.
Delete | Deletes a task.
Find | Finds task(s) with a specified keyword.
Exit | Exits the ChatBot.
Binary file added docs/ip jar screenshots/1.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 0 additions & 10 deletions src/main/java/Duke.java

This file was deleted.

3 changes: 3 additions & 0 deletions src/main/java/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: duke.command.Duke

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


/**
* Parses user input.
*/
public class Parser {
/**
* Parses user input into the respective important fields of the command for execution.
*
* @param fullCommand The entire string command entered in by the user.
* @return The parsed command that can be fed into the TaskList functions.
* @throws ArrayIndexOutOfBoundsException If the command is in the wrong format.
*/
public static String[] parse(String fullCommand) throws ArrayIndexOutOfBoundsException {
String[] words = fullCommand.split(" ", 2);
String commandWord = words[0].toLowerCase();

switch (commandWord) {
case "list":
case "bye":
case "help":
return words;
case "done":
case "delete":
String[] parsedFullCommand = fullCommand.split(" ");
return parsedFullCommand;
case "todo":
String description = words[1];
return new String[]{commandWord, description};
case "deadline":
description = words[1].split(" /by ")[0];
String by = words[1].split(" /by ")[1];
return new String[]{commandWord, description, by};
case "event":
description = words[1].split(" /at ")[0];
String at = words[1].split(" /at ")[1];
return new String[]{commandWord, description, at};
case "find":
String keyword = words[1];
return new String[]{commandWord, keyword};
default:
return new String[]{"wrong", "input"};
}
}
}
Loading