summaryrefslogtreecommitdiff
path: root/.obsidian/plugins/obsidian-git/obsidian_askpass.sh
diff options
context:
space:
mode:
Diffstat (limited to '.obsidian/plugins/obsidian-git/obsidian_askpass.sh')
-rwxr-xr-x.obsidian/plugins/obsidian-git/obsidian_askpass.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/.obsidian/plugins/obsidian-git/obsidian_askpass.sh b/.obsidian/plugins/obsidian-git/obsidian_askpass.sh
new file mode 100755
index 0000000..2e5eb5d
--- /dev/null
+++ b/.obsidian/plugins/obsidian-git/obsidian_askpass.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+PROMPT="$1"
+TEMP_FILE="$OBSIDIAN_GIT_CREDENTIALS_INPUT"
+
+cleanup() {
+ rm -f "$TEMP_FILE" "$TEMP_FILE.response"
+}
+trap cleanup EXIT
+
+echo "$PROMPT" > "$TEMP_FILE"
+
+while [ ! -e "$TEMP_FILE.response" ]; do
+ if [ ! -e "$TEMP_FILE" ]; then
+ echo "Trigger file got removed: Abort" >&2
+ exit 1
+ fi
+ sleep 0.1
+done
+
+RESPONSE=$(cat "$TEMP_FILE.response")
+
+echo "$RESPONSE"