Skip to content

Commit

Permalink
Polish code, readme, tests (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
damithc authored and AlexLMeow committed Jul 31, 2016
1 parent 57ab42d commit fe5655a
Show file tree
Hide file tree
Showing 7 changed files with 773 additions and 551 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ storage.txt
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
.idea/
AddressBook.iml
test/actual.txt
92 changes: 43 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

# Setting up
### Prerequisites
*
*
* JDK 8
* Eclipse IDE

### Importing the project into Eclipse
1. Open Eclipse
Expand All @@ -27,65 +27,59 @@
### Using Command Line Interface
1. Open `Terminal` for Unix or `Command Prompt` for Windows
2. Move to the project's bin directory, using `cd <project_path>/bin` for Unix and `dir <project_path>/bin` for Windows
3. Type `java nus.todobuddy.ToDoBuddy storageFilename.txt`, then `Enter` to execute
4. Command above enables you to interact with the program through the CLI and data will be saved in `storageFilename.txt`
3. Type `java nus.cs2103.addressbook.AddressBook [storage_file_name.txt]`, then <kbd>Enter</kbd> to execute
4. Command above enables you to interact with the program through the CLI and data will be saved in the file you specified

### Usage
```sh
Welcome to ToDoBuddy!
Enter command:help
add : Adds a to-do items to the storage.
Parameter: [priority] [duration] [title]
Example: add p/H d/0.5 Finish CS2103 Assignment
find : Retrieve to-do items that match the keyword, with/without priority.
Parameter: [keyword] [priority]
Example: find CS2103 or find CS2103 p/H
view : Shows sorted to-do list with its index numbers.
Example: view
delete : Deletes to-do item based on index numbers.
Parameter: [index number]
Example: delete 1
clear : Clears to-do list permanently.
Example: clear
exit : Exit from this program.
Example: exit
Enter command: help

add : Adds a person to the addressbook.
Parameters: [name] p/[phone number] e/[email]
Example: add John Doe p/98765432 e/[email protected]

find : Finds all persons whose names contain any of the specified keywords (case-sensitive) and displays them as a list with index numbers.
Parameters: [keyword 1] [keyword 2] ...
Example: find alice bob charlie

list : Displays all persons as a list with index numbers.
Example: view

delete : Deletes a person identified by the index number used in the last find/list call.
Parameters: [target's index number]
Example: delete 1
clear : Clears address book permanently.
Example: clear
exit : Exit the program.
Example: exit
help : Shows program usage instructions.
Example: help

Enter command:add p/H d/1.5 Do CS2103 coding exercise
New to-do item added: Do CS2103 coding exercise, Priority p/H, Duration d/1.5
Enter command:add p/L d/0.5 Check CS2103 next lecture slides
New to-do item added: Check CS2103 next lecture slides, Priority p/L, Duration d/0.5
Enter command:find CS2103
Do CS2103 coding exercise, Priority H, Duration 1.5
Check CS2103 next lecture slides, Priority L, Duration 0.5
Enter command:find CS5430
No to-do item exists with key word CS5430
Enter command:find CS5430 p/L
No to-do item exists with key word CS5430 and priority p/L
Enter command:find CS2103 p/L
Check CS2103 next lecture slides, Priority L, Duration 0.5
Enter command:view
1. Do CS2103 coding exercise, Priority H, Duration 1.5
2. Check CS2103 next lecture slides, Priority L, Duration 0.5
Enter command:delete 1
Deleted to-do item: Do CS2103 coding exercise, Priority H, Duration 1.5
Enter command:view
1. Check CS2103 next lecture slides, Priority L, Duration 0.5
Enter command:clear
To-do list has been cleared!
Enter command:view
No to-do item to be viewed
Enter command:exit
Example: help
```
# Testing
Make sure the file `storage.txt` exists in the working directory.
1. Open `Terminal` for Unix or `Command Prompt` for Windows
2. Move to the project's bin directory, using `cd <project_path>/bin` in Unix and `dir <project_path>/bin` in Windows
3. Type `java nus.todobuddy.ToDoBuddy storageFilename.txt < ../testing/input.txt > ../testing/output.txt`,
3. Type `java nus.todobuddy.ToDoBuddy storageFilename.txt < ../test/input.txt > ../test/output.txt`,
then `Enter` to execute
4. Command above will tell the program to save the data in `storageFilename.txt`,
then run the command provided from `../testing/input.txt`. Finally, it will write the output to `../testing/output.txt`

Sample Windows batch file to automate testing:
```sh
javac ..\src\nus\cs2103\addressbook\Addressbook.java -d ..\bin
java -classpath ..\bin nus.cs2103.addressbook.AddressBook < input.txt > actual.txt
FC actual.txt expected.txt
```
Put the code above into a file `test\test.bat`,
open a DOS window in the `test` folder,
and run the `call test.bat` command.

# Exercises

### ABL1-E1:
Expand All @@ -94,7 +88,7 @@ then run the command provided from `../testing/input.txt`. Finally, it will writ

### ABL1-E3:

# Acknowledgements
# External Acknowledgements
* Jeffry

# Contact us
Expand Down
Loading

0 comments on commit fe5655a

Please sign in to comment.