Forgot this existed
This commit is contained in:
parent
a27e7f561e
commit
f254b397a4
@ -1,13 +1,12 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
|
||||
JOURNAL_DIR=~/Journal
|
||||
cd $JOURNAL_DIR
|
||||
UPDATE_ALL=$JOURNAL_DIR/scripts/update_all.sh
|
||||
DATE=`date +'%Y-%m-%d'`
|
||||
FILE="$JOURNAL_DIR/$DATE.wiki"
|
||||
|
||||
[[ -f $JOURNAL_DIR/utils/journals.sh ]] && . $JOURNAL_DIR/utils/journals.sh
|
||||
[[ -f $JOURNAL_DIR/scripts/utils/journals.sh ]] && . $JOURNAL_DIR/scripts/utils/journals.sh
|
||||
|
||||
# Getting the last journal entry file
|
||||
declare -a journals
|
||||
@ -21,7 +20,7 @@ declare -A topics
|
||||
while read line; do
|
||||
# Stripping the '=' characters from the topic
|
||||
declare -i level=$( tr -cd '=' <<< "$line" | wc -c)
|
||||
[[ $level -eq 0 ]] && { echo "A line ($line) that was grabbed returned a 0 count level?"; exit 1; }
|
||||
[[ $level -eq 0 ]] && { echo "A line ($line) that was grabbed returned a 0 count level?"; continue; }
|
||||
|
||||
# Getting the topic "level" by getting the number of = in the topic and dividing it by 2
|
||||
#
|
||||
|
@ -1,5 +1,6 @@
|
||||
#!/usr/bin/bash
|
||||
JOURNAL_DIR=~/Journal
|
||||
FILES_DIR=$JOURNAL_DIR/files
|
||||
SCRIPT_DIR=$JOURNAL_DIR/scripts/enabled
|
||||
|
||||
#set -x
|
||||
|
@ -14,6 +14,8 @@ get_journals journals
|
||||
echo "
|
||||
%title Journal Index
|
||||
[[full_index.wiki|Full Index]]
|
||||
[[tasks.wiki|Tasks Index]]
|
||||
[[how-to.wiki|How-To Index]]
|
||||
|
||||
# Journals
|
||||
$(
|
||||
|
@ -3,6 +3,8 @@
|
||||
from pathlib import Path
|
||||
from utils.py.journals import *
|
||||
|
||||
SCRIPT_DIR=Path.home()/"Journal"/"scripts"
|
||||
SCRIPT_DIR.cwd()
|
||||
TASK_FILE=Path.home()/"Journal"/"tasks.wiki"
|
||||
|
||||
if not TASK_FILE.exists():
|
||||
|
20
scripts/utils/get-task.sh
Normal file
20
scripts/utils/get-task.sh
Normal file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/bash
|
||||
: "
|
||||
get_task_number
|
||||
This function will query sqlite db to either get the number of a task OR create the task and return the number
|
||||
|
||||
returns:
|
||||
-1 - Experienced error
|
||||
0 - Task was found
|
||||
1 - Task was created
|
||||
"
|
||||
function get_task_number() {
|
||||
local DB_PATH="${FILES_DIR:?"FILES_DIR was not set"}/task.db"
|
||||
local TASK_TITLE="${1:?"Task title was not provided"}"
|
||||
|
||||
local TASK_NUMBER="$(
|
||||
sqlite3 $DB_PATH <<< "
|
||||
SELECT
|
||||
"
|
||||
)"
|
||||
}
|
14
scripts/utils/task-db.sql
Normal file
14
scripts/utils/task-db.sql
Normal file
@ -0,0 +1,14 @@
|
||||
CREATE TABLE IF NOT EXISTS tasks (
|
||||
TASK_ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
TASK_TITLE TEXT NOT NULL,
|
||||
TASK_CREATION_DATE DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
TASK_DUE_DATE DATETIME DEFAULT DATETIME(CURRENT_TIMESTAMP, '+7 day')
|
||||
);
|
||||
|
||||
CREATE VIEW tasks_by_creation AS
|
||||
SELECT TASK_ID task_number, TASK_TITLE task_title, DATE(TASK_CREATION_DATE) creation_date FROM tasks
|
||||
ORDER BY TASK_CREATION_DATE ASC;
|
||||
|
||||
CREATE VIEW tasks_by_duedate AS
|
||||
SELECT TASK_ID task_number, TASK_TITLE task_title FROM tasks
|
||||
ORDER BY TASK_DUE_DATE ASC;
|
Loading…
Reference in New Issue
Block a user