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() {
|
||||
[ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue