From 90f436fb237951434edb567175efed23f749d90e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Tue, 15 Nov 2022 22:16:05 +0100 Subject: [PATCH] Allow specifying custom database name to init --- tag.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tag.sh b/tag.sh index 062f468..dc2af8d 100755 --- a/tag.sh +++ b/tag.sh @@ -34,9 +34,10 @@ log() { } init() { - [ -f "$DB_FILE" ] && fail "Database file \"$DB_FILE\" already exists. Aborting." - cat "$DB_SCHEMA" | sqlite3 "$DB_FILE" - log "Empty database file \"$DB_FILE\" created." + # DB_NAME + [ -f "$1" ] && fail "Database file \"$1\" already exists. Aborting." + cat "$DB_SCHEMA" | sqlite3 "$1" + log "Empty database file \"$1\" created." } enumerate_positional_parameters() { @@ -126,7 +127,7 @@ add_path_auto() { main() { if [[ "$1" = "init" ]]; then - init + init "${2:-$DB_FILE}" exit 0 fi