Adds raycast pass-attribute script

This commit is contained in:
2024-04-06 12:43:37 -04:00
parent b860ff8858
commit 65e8de5b75
2 changed files with 31 additions and 9 deletions

View File

@@ -0,0 +1,26 @@
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title pass-attribute
# @raycast.mode compact
# Optional parameters:
# @raycast.icon 🗝️
# @raycast.argument1 { "type": "text", "placeholder": "Key" }
# @raycast.argument2 { "type": "text", "placeholder": "For" }
# @raycast.packageName Password
# Documentation:
# @raycast.description Get an attribute / key from the password store
# @raycast.author Michael Housh
# @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"

View File

@@ -6,8 +6,8 @@
# @raycast.mode compact
# Optional parameters:
# @raycast.icon 🤖
# @raycast.argument1 { "type": "text", "placeholder": "name" }
# @raycast.icon 🔐
# @raycast.argument1 { "type": "text", "placeholder": "for" }
# @raycast.packageName Password
# Documentation:
@@ -15,17 +15,13 @@
# @raycast.author Michael Housh
# @raycast.authorURL https://github.com/m-housh
#echo "Hello World! Argument1 value: "$1""
PREFIX="$HOME/.local/share/password-store"
PASS=/opt/homebrew/bin/pass
selected=$(find "$PREFIX" -type f -name "$1".gpg)
echo "Selected find: $selected" > /tmp/pass-copy.out
if [[ -n "$selected" ]]; then
if [ -n "$selected" ]; then
selected="${selected//$PREFIX/}"
selected="${selected//.gpg/}"
echo "Selected cleaned: $selected" >> /tmp/pass-copy.out
pass -c "$selected"
"$PASS" --clip "$selected"
else
exit 1
fi