add database connect/query args to ani-cli

This commit is contained in:
ksyasuda 2022-01-07 10:54:29 -08:00
parent b1b263fb56
commit d19ea5f478

13
ani-cli
View File

@ -743,7 +743,7 @@ is_rofi=1
is_download=0
download_dir="."
half_ep=0
while getopts 'hd:Hsvq:c-:f:t:T:' OPT; do
while getopts 'hd:Hsvq:c-:f:t:T:CQ:' OPT; do
case "$OPT" in
h)
help_text
@ -822,6 +822,17 @@ while getopts 'hd:Hsvq:c-:f:t:T:' OPT; do
[ ! -f "$ROFI_CFG" ] && die "$ROFI_CFG does not exist"
logger "CUSTOM ROFI_CFG: $ROFI_CFG"
;;
C)
logger "Connecting to history database -> $CFG_DIR/history.sqlite3"
sqlite3 "$CFG_DIR/history.sqlite3"
exit $?
;;
Q)
query="$OPTARG"
logger "DATABASE QUERY: $query"
sqlite3 -line "$CFG_DIR/history.sqlite3" "$query"
exit $?
;;
*)
printf "%s\n" "Invalid option"
exit 1