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

[Lik Hern] iP #488

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
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
556af3f
Add Gradle support
May 24, 2020
f0c4e56
Add the ability to greet user, echo user input and exit program
Aug 20, 2022
4f8f316
Add the ability to store text and display to user when requested
Aug 20, 2022
f66f01b
Add the ability to mark/unmark tasks as done/not done yet
Aug 20, 2022
744d458
Add support for tracking three types of tasks: ToDos, Deadlines & Events
Aug 20, 2022
2da77c5
Set up automated text UI testing
Aug 20, 2022
324e1b1
Add the ability to handle certain exceptions
Aug 20, 2022
90aead3
Add support for deleting tasks from the list
Aug 20, 2022
c56dde6
Add the ability to save and load data from the hard disk
Sep 2, 2022
89d2bfb
Add the ability to identify certain date format and parse it correctly
Sep 2, 2022
4cd6136
Merge branch 'branch-Level-7'
Sep 2, 2022
51cda61
Merge branch 'branch-Level-8'
Sep 2, 2022
a200367
Arrange the code to more closely follow OOP design
Sep 4, 2022
634c9e6
Organize the classes into suitable java packages
Sep 9, 2022
399a384
Merge branch 'add-gradle-support' of https://github.com/nus-cs2103-AY…
Sep 9, 2022
f8ae081
Add Gradle support to the project
Sep 9, 2022
e1538fb
Add JUnit tests to test the behavior of the code
Sep 9, 2022
4e9edd6
Add JavaDoc comments to the code
Sep 9, 2022
abc6e72
Tweak the code to comply with a coding standard
Sep 9, 2022
120db3d
Add support for finding a task in task list by searching for a keyword
Sep 10, 2022
a97d88e
Merge branch 'branch-A-JavaDoc'
Sep 10, 2022
ead284b
Merge branch 'branch-A-CodingStandard'
Sep 10, 2022
ba7937c
Merge branch 'branch-Level-9'
Sep 10, 2022
050cef3
Add a GUI to Duke
Sep 12, 2022
d13c5bf
Merge branch 'branch-Level-10'
Sep 12, 2022
2bb32f4
Fixed minor problem related to GUI
Sep 12, 2022
cbb027c
Include assertions to verify certain assumptions
Sep 12, 2022
e75560b
Do refactor to improve code quality
Sep 12, 2022
cccbaca
Merge pull request #2 from LikHern/branch-A-Assertions
LikHern Sep 12, 2022
0921acb
Merge branch 'master' into branch-A-CodeQuality
Sep 12, 2022
859ae32
Merge pull request #3 from LikHern/branch-A-CodeQuality
LikHern Sep 12, 2022
5e6b548
Add support for archiving items
Sep 12, 2022
405f354
Add a User Guide to the project
Sep 13, 2022
7658174
Update README.md
LikHern Sep 13, 2022
b49dcb9
Update README.md
LikHern Sep 13, 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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ bin/

/text-ui-test/ACTUAL.txt
text-ui-test/EXPECTED-UNIX.TXT
duke.txt
duke-backup.txt
58 changes: 58 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
plugins {
id 'java'
id 'application'
id 'checkstyle'
id 'com.github.johnrengelman.shadow' version '5.1.0'
}

repositories {
mavenCentral()
}

dependencies {
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.5.0'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.5.0'

String javaFxVersion = '11'

implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'linux'
implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'linux'
implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'linux'
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'linux'
}

test {
useJUnitPlatform()

testLogging {
events "passed", "skipped", "failed"

showExceptions true
exceptionFormat "full"
showCauses true
showStackTraces true
showStandardStreams = false
}
}

application {
mainClassName = "duke.Launcher"
}

shadowJar {
archiveBaseName = "duke"
archiveClassifier = null
}

run{
standardInput = System.in
enableAssertions = true
}
112 changes: 98 additions & 14 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,113 @@
<!--
@@author LikHern-reused
Reused from https://se-education.org/addressbook-level3/UserGuide.html
with minor modifications
-->
# User Guide

Duke is a desktop app for managing tasks, optimized for use via a Command Line
Interface (CLI). If you can type fast, Duke can get your task management done
faster than traditional GUI apps.

## Quick start

1. Ensure you have Java `11` or above installed in your computer.
2. Download the latest `duke.jar` from [here](https://github.com/LikHern/ip/releases/tag/v1.0).
3. Copy the file to the folder you want to use as the _home folder_.
4. Double-click the file to start the app.
5. Refer to the Features below for details of each command.

## Features

### Feature-ABC
:left_speech_bubble: Notes about the command format:

- Words in `UPPER_CASE` are the parameters to be supplied by the user.
e.g. in `todo DESCRIPTION`, `DESCRIPTION` is a parameter which can be
used as `todo read book`.
- Extraneous parameters for commands that do not take in parameters
(such as `list` and `bye`) will be ignored.
e.g. if the command specifies `list 123`, it will be interpreted as `list`.

### Adding a task: `todo` `deadline` `event`

Duke supports tracking three types of tasks:

1. To-do: task without any date/time attached to it **_e.g., visit new theme park_**
:memo:
2. Deadline: task that need to be done before a specific date **_e.g., submit
report by 11/10/2019_** :calendar:
3. Event: task that start at a specific time and ends at a specific time **_e.g.,
team project meeting on 2/10/2019 2-4pm_** :alarm_clock:

Format: `todo DESCRIPTION`, `deadline DESCRIPTION /by DATE`, `event DESCRIPTION /at DATETIME`

:warning: **`DATE` in deadline can only take in date in "yyyy-MM-dd" format, e.g.,
2022-12-06**

Examples:
- todo read book
- deadline return book /by 2022-12-06
- event project meeting /at Aug 6th 2-4pm

### Listing all tasks: `list`

Shows a list of all tasks in Duke.

Format: `list`

### Marking/Unmarking a task as completed: `mark` `unmark`

Marks/Unmarks a task in Duke as done/not done yet.

Format: `mark INDEX`, `unmark INDEX`

:left_speech_bubble: `INDEX` follows 1-based indexing and should be an integer.

### Deleting a task: `delete`

Deletes a task in Duke.

Format: `delete INDEX`

:left_speech_bubble: `INDEX` follows 1-based indexing and should be an integer.

### Finding task by name: `find`

Finds any task which the description contains the exact given keyword(s).

Format: `find KEYWORDS`

- The search is case-insensitive. e.g., `book` will match `Book`
- The search is partial matching. e.g., `oo` will match `book`

### Archiving tasks: `archive`

Archive the tasks saved in Duke to back-up file.

Format: `archive`

Description of the feature.
:warning: **After this operation, all the tasks in Duke will be cleared!**

### Feature-XYZ
### Exiting the program: `bye`

Description of the feature.
Exits the program.

## Usage
Format: `bye`

### `Keyword` - Describe action
### Saving the data:

Describe the action and its outcome.
Duke data are saved in the hard disk automatically after any command. There is
no need to save manually.

Example of usage:
### Editing the data file

`keyword (optional arguments)`
Duke data and back-up data are saved as a txt file in
`[JAR file location]/duke.txt` and `[JAR file location]/duke-backup.txt` respectively.
Advanced users are welcome to update data directly by editing that data file.

Expected outcome:
:warning: **If your changes to the data file makes its format invalid, Duke will
discard all data and start with an empty data file at the next run.**

Description of the outcome.
### Retrieving data from archive [coming in v2.0]

```
expected output
```
Details coming soon...
Binary file added docs/Ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
183 changes: 183 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn () {
echo "$*"
}

die () {
echo
echo "$*"
echo
exit 1
}

# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi

# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option

if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

exec "$JAVACMD" "$@"
Loading