mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-15 06:32:40 +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
|
# @raycast.mode compact
|
||||||
|
|
||||||
# Optional parameters:
|
# Optional parameters:
|
||||||
# @raycast.icon 🤖
|
# @raycast.icon 🔐
|
||||||
# @raycast.argument1 { "type": "text", "placeholder": "name" }
|
# @raycast.argument1 { "type": "text", "placeholder": "for" }
|
||||||
# @raycast.packageName Password
|
# @raycast.packageName Password
|
||||||
|
|
||||||
# Documentation:
|
# Documentation:
|
||||||
@@ -15,17 +15,13 @@
|
|||||||
# @raycast.author Michael Housh
|
# @raycast.author Michael Housh
|
||||||
# @raycast.authorURL https://github.com/m-housh
|
# @raycast.authorURL https://github.com/m-housh
|
||||||
|
|
||||||
#echo "Hello World! Argument1 value: "$1""
|
|
||||||
|
|
||||||
PREFIX="$HOME/.local/share/password-store"
|
PREFIX="$HOME/.local/share/password-store"
|
||||||
|
PASS=/opt/homebrew/bin/pass
|
||||||
selected=$(find "$PREFIX" -type f -name "$1".gpg)
|
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//$PREFIX/}"
|
||||||
selected="${selected//.gpg/}"
|
selected="${selected//.gpg/}"
|
||||||
echo "Selected cleaned: $selected" >> /tmp/pass-copy.out
|
"$PASS" --clip "$selected"
|
||||||
pass -c "$selected"
|
|
||||||
else
|
else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user