mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 06:12:34 +00:00
Updates to nvim to harden for gopass
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/bin/zsh -l
|
||||
|
||||
# Required parameters:
|
||||
# @raycast.schemaVersion 1
|
||||
@@ -17,10 +17,32 @@
|
||||
# @raycast.authorURL https://github.com/m-housh
|
||||
|
||||
PREFIX="$HOME/.local/share/password-store"
|
||||
PASS=/opt/homebrew/bin/pass
|
||||
key="$1"
|
||||
selected=$(find "$PREFIX" -type f -name "$2.gpg")
|
||||
selected="${selected//$PREFIX/}"
|
||||
selected="${selected//.gpg/}"
|
||||
"$PASS" get --clip "$key" "$selected"
|
||||
PASS="$(command -v pass)"
|
||||
|
||||
#
|
||||
# Begin program
|
||||
#
|
||||
[ -z "$PASS" ] && \
|
||||
echo "Error: pass utility not found." && \
|
||||
exit 1
|
||||
|
||||
key="$1"
|
||||
file="$2"
|
||||
selected=$(find "$PREFIX" -type f -name "$file.gpg")
|
||||
|
||||
# Check if we found a password file at the path.
|
||||
[ -z "$selected" ] && \
|
||||
echo "Path not found: $file" && \
|
||||
exit 1
|
||||
|
||||
# Sanitize the path to work with the pass command.
|
||||
selected="${selected//$PREFIX\//}"
|
||||
selected="${selected//.gpg/}"
|
||||
|
||||
# Capture the result of searching for the key.
|
||||
result=$("$PASS" get "$key" "$selected")
|
||||
|
||||
[ -z "$result" ] && echo "Key not found" && exit 1
|
||||
echo "$result" | pbcopy
|
||||
echo "$key: Copied to clipboard"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/bin/zsh -l
|
||||
|
||||
# Required parameters:
|
||||
# @raycast.schemaVersion 1
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
# Optional parameters:
|
||||
# @raycast.icon 🔐
|
||||
# @raycast.argument1 { "type": "text", "placeholder": "for" }
|
||||
# @raycast.argument1 { "type": "text", "placeholder": "For" }
|
||||
# @raycast.packageName Password
|
||||
|
||||
# Documentation:
|
||||
@@ -16,13 +16,32 @@
|
||||
# @raycast.authorURL https://github.com/m-housh
|
||||
|
||||
PREFIX="$HOME/.local/share/password-store"
|
||||
PASS=/opt/homebrew/bin/pass
|
||||
selected=$(find "$PREFIX" -type f -name "$1".gpg)
|
||||
if [ -n "$selected" ]; then
|
||||
selected="${selected//$PREFIX/}"
|
||||
selected="${selected//.gpg/}"
|
||||
"$PASS" --clip "$selected"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
LOG=/tmp/pass-copy.out
|
||||
ISOSEC="$HOME/.local/share/scripts/isosec"
|
||||
PASS="$(command -v pass)"
|
||||
|
||||
_log() {
|
||||
echo "$($ISOSEC) $1" >> "$LOG"
|
||||
}
|
||||
|
||||
#
|
||||
# Begin program
|
||||
#
|
||||
[ -z "$PASS" ] && \
|
||||
echo "Error: pass utility not found." && \
|
||||
_log "Error: pass utility not found." && \
|
||||
exit 1
|
||||
|
||||
selected=$(find "$PREFIX" -type f -name "$1".gpg)
|
||||
|
||||
[ -z "$selected" ] && \
|
||||
_log "Error: Not Found" && \
|
||||
_log "Input: $1" && \
|
||||
exit 1
|
||||
|
||||
selected="${selected//$PREFIX\//}"
|
||||
selected="${selected//.gpg/}"
|
||||
_log "Running pass with selection: $selected"
|
||||
"$PASS" --clip "$selected"
|
||||
|
||||
|
||||
|
||||
33
scripts/scripts/raycast/pass-gen.sh
Executable file
33
scripts/scripts/raycast/pass-gen.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/zsh -l
|
||||
|
||||
# Required parameters:
|
||||
# @raycast.schemaVersion 1
|
||||
# @raycast.title pass-gen
|
||||
# @raycast.mode compact
|
||||
|
||||
# Optional parameters:
|
||||
# @raycast.icon 🔐
|
||||
# @raycast.argument1 { "type": "text", "placeholder": "Path" }
|
||||
# @raycast.packageName Password
|
||||
|
||||
# Documentation:
|
||||
# @raycast.description Copy password from password-store
|
||||
# @raycast.author Michael Housh
|
||||
# @raycast.authorURL https://github.com/m-housh
|
||||
|
||||
PREFIX="$HOME/.local/share/password-store"
|
||||
PASS="$(command -v pass)"
|
||||
|
||||
[ -z "$PASS" ] && \
|
||||
echo "Error: pass utility not found." && \
|
||||
exit 1
|
||||
|
||||
[ -z "$1" ] && \
|
||||
echo "Error: must supply a name/path for the password" && \
|
||||
exit 1
|
||||
|
||||
"$PASS" generate --clip "$1"
|
||||
|
||||
_log "Ending"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user