From 888557171d61589211b10f70dce405126216ad61 Mon Sep 17 00:00:00 2001 From: Elias Schneider Date: Mon, 13 Jan 2025 12:32:22 +0100 Subject: [PATCH] fix: optional arguments not working with `create-one-time-access-token.sh` --- scripts/create-one-time-access-token.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/create-one-time-access-token.sh b/scripts/create-one-time-access-token.sh index 30a4f73..d9ca8f3 100644 --- a/scripts/create-one-time-access-token.sh +++ b/scripts/create-one-time-access-token.sh @@ -1,6 +1,5 @@ DB_PATH="./backend/data/pocket-id.db" DB_PROVIDER="${DB_PROVIDER:=sqlite}" -USER_IDENTIFIER="$1" # Parse command-line arguments for the -d flag (database path) while getopts ":d:" opt; do @@ -15,10 +14,12 @@ while getopts ":d:" opt; do esac done +# Shift past the processed options shift $((OPTIND - 1)) # Ensure username or email is provided as a parameter -if [ -z "$1" ]; then +USER_IDENTIFIER="$1" +if [ -z "$USER_IDENTIFIER" ]; then echo "Usage: $0 [-d ] " if [ "$DB_PROVIDER" == "sqlite" ]; then echo "-d (optional): Path to the SQLite database file. Default: $DB_PATH" @@ -104,4 +105,4 @@ else echo "Error creating access token." exit 1 fi -echo "=================================================" +echo "=================================================" \ No newline at end of file