#!/usr/bin/env bash initKnowledgeBase(){ local output necho -e "${YELLOW}Initialising Knowledge base${NC}" vecho "Directory: $dataDir" if [ "$verbose" -gt 0 ]; then output="/dev/stdout" else output="/dev/null" fi [ -e "$dataDir" ] && die "$dataDir already exists" mkdir -p "$dataDir" if [ "$dogit" -gt 0 ]; then git init "$dataDir" > "$output" # TODO: make gitignore use new sqlite file echo "/knowledgebase.sqlite3" >> "${dataDir}/.gitignore" git -C "$dataDir" add .gitignore > "$output" git -C "$dataDir" commit -m "Knowledge base initialised" > output fi vecho "Creating Database" echo 'CREATE TABLE items (id integer primary key, filename text, title text, type text); CREATE TABLE tags (id integer primary key, name text); CREATE TABLE links (id integer primary key, itemID integer, tagID integer); ' | sqlite3 "${sqliteFile}" necho -e "${GREEN}Initialised Knowledge base${NC}" }