]> gitweb.fluxo.info Git - keyringer.git/commitdiff
Feat: new search and ssearch actions
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 25 Oct 2025 16:24:05 +0000 (13:24 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 25 Oct 2025 16:24:05 +0000 (13:24 -0300)
ChangeLog
lib/keyringer/actions/sclip
lib/keyringer/actions/search [new symlink]
lib/keyringer/actions/ssearch [new symlink]
lib/keyringer/actions/xclip
lib/keyringer/completions/bash/keyringer
lib/keyringer/completions/zsh/_keyringer

index 9f079a513bba427eac6b8ae6e4a9d0a7f883e6fd..5958d1f1eb93988b90f510b7b1e24ec4340074aa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
 
        Makefile: uninstall targets (thanks Spenser Truex <truex@equwal.com>).
 
+       New "search" and "ssearch" actions.
+
 2025-01-04 - 0.6.0 - Silvio Rhatto <rhatto@riseup.net>
 
        Fix: check action now exits with non-zero status if there are expiring keys
index de9c3b58c5e5bc552aad015dbfcee955c4f897ee..e513e8d8a258816dd6308146c6c1366ac858f8a0 100755 (executable)
@@ -7,9 +7,16 @@
 LIB="`dirname $0`/../functions"
 source "$LIB" read $* || exit 1
 
+# Determine action
+if [ "$(basename "$0")" == "ssearch" ]; then
+  action="search"
+else
+  action="xclip"
+fi
+
 # Clip password
 shift
-keyringer $KEYRING xclip $*
+keyringer $KEYRING $action $*
 
 # Se window switch combo
 if [ -z "$XDOTOOL_NEXT_WINDOW" ]; then
diff --git a/lib/keyringer/actions/search b/lib/keyringer/actions/search
new file mode 120000 (symlink)
index 0000000..8b8c16c
--- /dev/null
@@ -0,0 +1 @@
+xclip
\ No newline at end of file
diff --git a/lib/keyringer/actions/ssearch b/lib/keyringer/actions/ssearch
new file mode 120000 (symlink)
index 0000000..10534ec
--- /dev/null
@@ -0,0 +1 @@
+sclip
\ No newline at end of file
index ff82cc1821d89cf7a36602e5e7365955f811f5f7..a1895452d6b9ffa2cc46998998ce838c43cbe78f 100755 (executable)
@@ -57,8 +57,15 @@ if ! which xclip &> /dev/null; then
   exit 1
 fi
 
+# Find our search mode
+if [ "$(basename "$0")" == "search" ] && [ -z "$2" ]; then
+  read -p "Enter option (Ctrl-C to abort): " query
+else
+  query="$2"
+fi
+
 # Get file
-keyringer_get_file "$2"
+keyringer_get_file "$query"
 
 # Decrypt
 pass="$($GPG --use-agent -d "$KEYDIR/$FILE" | head -n 1)"
index 4aa4b75443a241b329ca6b4078f3a0e3ce07f2b4..3e70e4ca7ec648b8f89c206bbfad7190bd49c92b 100644 (file)
@@ -3,7 +3,7 @@
 #
 
 if [[ -n ${ZSH_VERSION-} ]]; then
-       autoload -U +X bashcompinit && bashcompinit
+  autoload -U +X bashcompinit && bashcompinit
 fi
 
 # Completion for git subcommand
@@ -92,7 +92,7 @@ _keyringer() {
       recipients)
         opts="ls edit"
         ;;
-      ls|tree|mkdir|encrypt|encrypt-batch|pwgen|decrypt|edit|append|append-batch|del|rm|recrypt|open|clip|xclip|sclip|find|mv|cp)
+      ls|tree|mkdir|encrypt|encrypt-batch|pwgen|decrypt|edit|append|append-batch|del|rm|recrypt|open|clip|xclip|sclip|search|ssearch|find|mv|cp)
         cur="`echo ${cur} | sed -e "s|^/*||"`" # avoid leading slash
         opts="$(bash -c "set -f && export KEYRINGER_CHECK_RECIPIENTS=false && export KEYRINGER_CHECK_VERSION=false && keyringer $instance ls -p -d ${cur}*" 2> /dev/null)"
         ;;
index 756235238d7409aa5f0f62432e40cd24e1fbc5c1..0ac6c7f60d2c31917ff6551bd0331e4ef79a41a8 100644 (file)
@@ -49,7 +49,7 @@ _keyringer() {
           recipients)
             compadd "$@" ls edit
             ;;
-          ls|tree|mkdir|encrypt|encrypt-batch|pwgen|decrypt|edit|append|append-batch|del|rm|recrypt|open|clip|xclip|sclip|find|mv|cp)
+          ls|tree|mkdir|encrypt|encrypt-batch|pwgen|decrypt|edit|append|append-batch|del|rm|recrypt|open|clip|xclip|sclip|search|ssearch|find|mv|cp)
             words[4]="`echo $words[4] | sed -e "s|^/*||"`" # avoid leading slash
             compadd "$@" $(KEYRINGER_CHECK_RECIPIENTS=false KEYRINGER_CHECK_VERSION=false keyringer $words[2] ls -p -d $words[4]'*' 2> /dev/null)
             ;;
@@ -96,7 +96,7 @@ _keyringer() {
           true
         fi
         ;;
-    esac 
+    esac
 }
 
 _keyringer "$@"