-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtodo
More file actions
executable file
·30 lines (29 loc) · 707 Bytes
/
todo
File metadata and controls
executable file
·30 lines (29 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
ROOT_PATH="$HOME/cs/to-do-list"
DATABASE=todo.db
SQL=create.sql
MAIN=main.py
cd $ROOT_PATH
# If database file exists
if [ -f $DATABASE ]; then
# If more than 0 arguments were supplied
if [ $# -gt 0 ]; then
# If user wants to reset ToDo Database
if [ $1 == "-n" ] || [ $1 == "--new" ]; then
# Run create.sql on Database and open ToDo Shell
sqlite3 $DATABASE < $SQL
python $MAIN $DATABASE "-s"
else
# Otherwise pass arguments to program
python $MAIN $DATABASE "$1" "$2" "$3"
fi
else
# Display the ToDo Task-List
python $MAIN $DATABASE
fi
else
# Create Database File and start ToDo List shell
touch $DATABASE
sqlite3 $DATABASE < $SQL
python $MAIN $DATABASE "-s"
fi