Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
edede19
initialize project
johnsuharjono Jan 27, 2022
25d1b25
week 3 part 1
johnsuharjono Jan 27, 2022
28ad6a1
Week 3 Part 2
johnsuharjono Jan 27, 2022
8818d7e
Week 3 Part 3
johnsuharjono Jan 27, 2022
d6193fc
Week 3 Coding Standard
johnsuharjono Feb 3, 2022
e835c55
Add TaskManager Class
johnsuharjono Feb 3, 2022
5cf003e
Add TaskManager class
johnsuharjono Feb 3, 2022
dca4adb
Level 4. Add ToDos, Events, Deadlines Class
johnsuharjono Feb 3, 2022
6b84407
Improve code quality, add constant
johnsuharjono Feb 3, 2022
cb38ba5
improve code quality
johnsuharjono Feb 10, 2022
0852ee7
Adding exception for mark, unmark, todo, and invalid command
johnsuharjono Feb 10, 2022
a235cc3
create package
johnsuharjono Feb 10, 2022
468c600
Merge branch 'branch-A-Packages'
johnsuharjono Feb 10, 2022
f3bf057
change array to ArrayList
johnsuharjono Feb 17, 2022
2338c4c
Add delete function
johnsuharjono Feb 17, 2022
2656fb6
add data/brave.txt
johnsuharjono Feb 17, 2022
7947f40
Add file reading
johnsuharjono Feb 18, 2022
0aa5613
Merge branch 'branch-Level-6'
johnsuharjono Feb 18, 2022
301e9b0
Merge branch 'branch-Level-7'
johnsuharjono Feb 18, 2022
b6b4efb
Merge level 6 and level 7, finish read and write file
johnsuharjono Feb 18, 2022
acb94a4
delete some comments
johnsuharjono Mar 2, 2022
612bddc
Create more class
johnsuharjono Mar 3, 2022
6e125a8
Add find method
johnsuharjono Mar 3, 2022
80ecdee
Merge pull request #1 from johnsuharjono/branch-Level-9
johnsuharjono Mar 3, 2022
60b0564
Merge branch 'master' of https://github.com/johnsuharjono/ip
johnsuharjono Mar 3, 2022
ed140e7
Added JavaDoc
johnsuharjono Mar 3, 2022
5c02612
Merge pull request #2 from johnsuharjono/branch-javaDoc
johnsuharjono Mar 3, 2022
efb6d5e
Merge branch 'master' of https://github.com/johnsuharjono/ip
johnsuharjono Mar 3, 2022
46a7af1
Add User Guide
johnsuharjono Mar 3, 2022
29771b5
Edit User Guide and UI Message
johnsuharjono Mar 4, 2022
351848e
no message
johnsuharjono Mar 4, 2022
1b86e4d
Set theme jekyll-theme-cayman
johnsuharjono Mar 4, 2022
cb35164
Handle case when file or directory not exist by creating a new direct…
johnsuharjono Mar 4, 2022
8fb5a28
Merge branch 'master' of https://github.com/johnsuharjono/ip
johnsuharjono Mar 4, 2022
657eb5a
edit user guide
johnsuharjono Mar 4, 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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Duke project template
# Duke

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 All @@ -17,7 +17,7 @@ Prerequisites: JDK 11, update Intellij to the most recent version.
```
Hello from
____ _
| _ \ _ _| | _____
| _ \ _ _| | _____
| | | | | | | |/ / _ \
| |_| | |_| | < __/
|____/ \__,_|_|\_\___|
Expand Down
5 changes: 5 additions & 0 deletions data/brave.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
T , 1 , read book
D , 1 , return book , June 6th
E , 0 , project meeting , Aug 6th 2-4pm
T , 1 , join sports club
T , 0 , cs2113 lecture
212 changes: 200 additions & 12 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,217 @@
# User Guide

Brave is a **Command Line Interface (CLI) application** for you to manage your daily task
Todo - Event - Deadline

- [Quick Start](#quick-start)
- [Features](#features)
- [Adding a Todo: `todo`](#adding-a-todo-todo)
- [Adding a Deadline: `deadline`](#adding-a-deadline-deadline)
- [Adding an Event: `event`](#adding-an-event-event)
- [Listing all tasks: `list`](#listing-out-all-tasks-list)
- [Marking a task as done: `mark`](#marking-a-task-as-completed-mark)
- [Marking a task as incomplete : `unmark`](#marking-a-task-as-incomplete-unmark)
- [Deleting a task: `delete`](#deleting-a-task-delete)
- [Searching for tasks: `find`](#searching-for-tasks-find)
- [Exiting the program: `bye`](#exiting-the-program-bye)

## Quick Start
1. Prerequisites: JDK 11, update Intellij to the most recent version.
2. Download the latest copy of `ip.jar` from the [Releases](https://github.com/johnsuharjono/ip/releases) page.
3. Open your Command Prompt (Windows) or Terminal (Mac/Linux), and navigate to the folder you created.
4. Run the command `java -jar ip.jar`, this will be shown in your terminal if successfull
```
-*|Brave|*------------------------------------
Greetings from
____ _
| __ ) _ __ __ ___ _____ | |
| _ \| '__/ _` \ \ / / _ \ | |
| |_) | | | (_| |\ V / __/ |_|
|____/|_| \__,_| \_/ \___| (_)

What can I do for you?
----------------------------------------------
```

## Features

### Feature-ABC
### Adding a Todo: `todo`

Create a To-Do type task

**Format:** `todo <description>`

**Example Input:**
```
todo learn web development
```

**Example Output:**
```
-*|Brave|*------------------------------------
Okay! I have added task below!
[T][ ] learn web development
You currently have 6 task in the list
----------------------------------------------
```

### Adding a Deadline: `deadline`

Create a Deadline type task

**Format:** `deadline <description> /by <time>`

**Example Input:**
```
deadline finish math homework /by Thursday Morning
```

**Example Output:**
```
-*|Brave|*------------------------------------
Okay! I have added task below!
[D][ ] finish math homework (by: Thursday Morning)
You currently have 8 task in the list
----------------------------------------------
```

### Adding an Event: `event`

Add an Event type task

**Format:** `event <description> /at <time>`

**Example Input:**
```
event Brave's birthday /at 4 March 2022
```

**Example Output:**
```
-*|Brave|*------------------------------------
Okay! I have added task below!
[E][ ] Brave's birthday (at: 4 March 2022)
You currently have 7 task in the list
----------------------------------------------
```

### Listing out all tasks: `list`

Shows all currently stored task by Brave

**Format:** `list`

**Example Output:**
```
-*|Brave|*------------------------------------
1 [T][X] read book
2 [D][X] return book (by: June 6th)
3 [E][ ] project meeting (at: Aug 6th 2-4pm)
4 [T][X] join sports club
5 [T][ ] cs2113 lecture
6 [T][ ] learn web development
7 [E][ ] Brave's birthday (at: 4 March 2022)
8 [D][ ] finish math homework (by: Thursday Morning)
----------------------------------------------
```

### Marking a task as completed: `mark`

Brave will mark the given task as completed

**Format:** `mark <index>`

> **️ Note:** index can be seen from calling `list` command


**Example Input:**
```
mark 3
```

**Example Output:**
```
-*|Brave|*------------------------------------
Nice! I've marked this task as done:
[E][X] project meeting (at: Aug 6th 2-4pm)
----------------------------------------------
```

Description of the feature.
### Marking a task as incomplete: `unmark`

### Feature-XYZ
Brave will mark the given task as incomplete

Description of the feature.
**Format:** `unmark <index>`

## Usage
> **️ Note:** index can be seen from calling `list` command

### `Keyword` - Describe action

Describe the action and its outcome.
**Example Input:**
```
unmark 3
```

Example of usage:
**Example Output:**
```
-*|Brave|*------------------------------------
OK, I've marked this task as not done yet:
[E][ ] project meeting (at: Aug 6th 2-4pm)
----------------------------------------------
```

### Deleting a task: `delete`

`keyword (optional arguments)`
Remove a task stored by Brave.

Expected outcome:
**Format:** `delete <index>`

Description of the outcome.
> **Note:**
> `<index>` can be referenced from the `list` command.

**Example Input:**
```
expected output
delete 6
```

**Example Output:**
```
-*|Brave|*------------------------------------
I managed to delete task below!
[T][ ] learn web development
You now have 7 task remaining
----------------------------------------------
```

### Searching for tasks: `find`

Filter the task base on `<keyword>`

**Format:** `find <keyword>`

**Example Input:**
```
find book
```

**Example Output:**
```
find book
-*|Brave|*------------------------------------
1 [T][X] read book
2 [D][X] return book (by: June 6th)
----------------------------------------------
```

### Exiting the program: `bye`

Quits the program.

**Format:** `bye`

**Output:**
```
-*|Brave|*------------------------------------
Bye, Hope to see you again soon!
----------------------------------------------
```

1 change: 1 addition & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
theme: jekyll-theme-cayman
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: brave.Brave

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

import brave.data.TaskManager;
import brave.parser.Parser;
import brave.ui.Ui;
import brave.storage.Storage;

import java.io.IOException;
import java.lang.String;
import java.nio.file.Path;


/**
* Represent the entry point for Brave-Bot Task Helper
* Initialize the UI, TaskManager, and Storage component.
*/
public class Brave {

private final Ui ui;
private TaskManager tasks;
private final Storage storage;

/**
* Initialize the UI, loading the file data from storage
*
* @param filePath filepath for the program to read from
*/
public Brave(String filePath) {
ui = new Ui();
storage = new Storage(filePath);
try {
tasks = new TaskManager(storage.load());
} catch (IOException e) {
ui.showLoadingError(e.getMessage());
tasks = new TaskManager();
}
}

/**
* Read the user input command,
* Keep iterating until stop condition is reached
*/
public void run() {
ui.showWelcomeMessage();
boolean isExit = false;

while (!isExit) {
String fullCommand = ui.getUserCommand();
Parser p = new Parser(ui, storage);
p.parse(fullCommand, tasks);
isExit = p.getExit();
}

ui.showFarewellMessage();
}

public static void main(String[] args) {
String DIR_PATH = String.valueOf(Path.of(System.getProperty("user.dir"), "data"));
new Brave(DIR_PATH + "/brave.txt").run();
}
}
4 changes: 4 additions & 0 deletions src/main/java/brave/IllegalArgumentException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package brave;

public class IllegalArgumentException extends Exception{
}
40 changes: 40 additions & 0 deletions src/main/java/brave/data/Deadline.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package brave.data;

/**
* Inherit from Task class, with additional "by" as the deadline
*/
public class Deadline extends Task {
private String by;

/**
* Class constructor
* @param description description for the given task
* @param by indicating the deadline of given task
*/
public Deadline(String description, String by) {
super(description);
this.by = by;
}

public String getDescription() {
return super.getDescription() + String.format(" (by: %s)", this.by);
}

/**
* Override print method
* @return String that is correctly formatted
*/
@Override
public String toString() {
return "[D]" + super.toString();
}

@Override
public String getSaveFormat() {
if (!isDone) {
return "D , 0 , " + this.description + " , " + this.by;
} else {
return "D , 1 , " + this.description + " , " + this.by;
}
}
}
Loading