Allow specifying custom database name to init
This commit is contained in:
parent
dcbc0b23d6
commit
90f436fb23
9
tag.sh
9
tag.sh
|
@ -34,9 +34,10 @@ log() {
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
[ -f "$DB_FILE" ] && fail "Database file \"$DB_FILE\" already exists. Aborting."
|
# DB_NAME
|
||||||
cat "$DB_SCHEMA" | sqlite3 "$DB_FILE"
|
[ -f "$1" ] && fail "Database file \"$1\" already exists. Aborting."
|
||||||
log "Empty database file \"$DB_FILE\" created."
|
cat "$DB_SCHEMA" | sqlite3 "$1"
|
||||||
|
log "Empty database file \"$1\" created."
|
||||||
}
|
}
|
||||||
|
|
||||||
enumerate_positional_parameters() {
|
enumerate_positional_parameters() {
|
||||||
|
@ -126,7 +127,7 @@ add_path_auto() {
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
if [[ "$1" = "init" ]]; then
|
if [[ "$1" = "init" ]]; then
|
||||||
init
|
init "${2:-$DB_FILE}"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue