Skip to content

Commit

Permalink
Imporove custom confirmation dialogue
Browse files Browse the repository at this point in the history
- use shebang for easier multiline input
- use bash for easier (and correct; the double quotes were missing)
  conditions with `[[ ]]`
- use case-insensitive matching so we can answer with `j` as well¡
  • Loading branch information
lukasjuhrich committed Jan 21, 2024
1 parent d3b1901 commit 4b8eb3c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/env just
#!/usr/bin/env just
# To install `just`, see
# https://github.com/casey/just#packages

Expand Down Expand Up @@ -33,14 +33,15 @@ build:
docker buildx bake

# initializes the dev db with the instance
schema-import: _confirm-drop \
_schema-import (alembic "upgrade" "head")
schema-import: _confirm-drop _schema-import (alembic "upgrade" "head")

_confirm-drop:
@read -p "Möchten Sie die Datenbank neu importieren?(J/n) " con; \
if [ $con != "J" ]; then \
echo "Datenbanklöschung abgebrochen."; \
exit 1; \
#!/usr/bin/env bash
read -p "Möchten Sie die Datenbank neu importieren? (J/n) " -n 1 con;
echo;
if [[ ! $con =~ [Jj] ]]; then
echo "Datenbanklöschung abgebrochen.";
exit 1;
fi
_schema-import: _ensure_schema_dir _stop_all (_up "dev-db")
Expand Down

0 comments on commit 4b8eb3c

Please sign in to comment.