mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 06:12:34 +00:00
Adds raycast pass-attribute script
This commit is contained in:
26
scripts/scripts/raycast/pass-attribute.sh
Executable file
26
scripts/scripts/raycast/pass-attribute.sh
Executable 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"
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user