From 1d7d4720df16c41c96e17440b8c6f36658f02ae4 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 26 Jul 2015 14:00:12 -0300 Subject: Slightly more interactive keyringer_get_file --- lib/keyringer/functions | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/keyringer/functions b/lib/keyringer/functions index ab519b2..70a107d 100755 --- a/lib/keyringer/functions +++ b/lib/keyringer/functions @@ -430,16 +430,18 @@ function keyringer_get_option { function keyringer_get_file { FILE="$(keyringer_filename "$RELATIVE_PATH/$1")" - if [ -z "$FILE" ]; then - keyringer_action_usage - exit 1 - elif [ ! -f "$KEYDIR/$FILE" ]; then + if [ ! -f "$KEYDIR/$FILE" ]; then # Try to find a similar file + FILE="" count=0 candidates=(`keyringer_exec find "$BASEDIR" | grep -i "$1" | grep -e '.asc$'`) if [ ! -z "$candidates" ]; then - echo "Could not find exact match for \"$1\", please choose one of the following secrets:" + if [ ! -z "$1" ]; then + echo "Could not find exact match for \"$1\"" + fi + + echo "Choose one of the following or type a pattern:" echo "" for candidate in ${candidates[@]}; do @@ -452,15 +454,20 @@ function keyringer_get_file { if [[ "$option" =~ ^[0-9]+$ ]] && [ ! -z "${candidates[$option]}" ]; then FILE="$(keyringer_filename "$RELATIVE_PATH/${candidates[$option]}")" - else - echo "Invalid option" - exit 1 + elif [ ! -z "$option" ]; then + keyringer_get_file $option fi else - echo "File not found: $KEYDIR/$FILE" - exit 1 + echo "Nothing matches $option, try again." + keyringer_get_file fi fi + + # Probably Ctrl-D was hit + if [ -z "$FILE" ]; then + echo "" + exit + fi } # Get a new file argument -- cgit v1.2.3 From a690fd2a4ba5975a9e495066621cf468e8e98c43 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 26 Jul 2015 14:15:09 -0300 Subject: Allow @ at file names --- lib/keyringer/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/keyringer/functions b/lib/keyringer/functions index 70a107d..09b004d 100755 --- a/lib/keyringer/functions +++ b/lib/keyringer/functions @@ -480,7 +480,7 @@ function keyringer_get_new_file { fi # Sanitize and complete file name - FILE="`echo $FILE | sed -e 's/[^A-Za-z0-9.\/\-]/_/g'`" + FILE="`echo $FILE | sed -e 's/[^A-Za-z0-9@.\/\-]/_/g'`" # Warn user about file name change if [ "`basename "$*"`" != "`basename $FILE`" ]; then -- cgit v1.2.3 From cf4c25c4b2ff8d7b4a80197a661aa8f32b7e0eeb Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 29 Nov 2015 12:34:06 -0200 Subject: Ensure destination path exists at mv action --- lib/keyringer/actions/mv | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib') diff --git a/lib/keyringer/actions/mv b/lib/keyringer/actions/mv index 2324145..e31eb85 100755 --- a/lib/keyringer/actions/mv +++ b/lib/keyringer/actions/mv @@ -24,5 +24,8 @@ if ! echo "$ORIG" | grep -q '*' && [ ! -e "$KEYDIR/$RELATIVE_PATH/$ORIG" ]; then exit 1 fi +# Ensure destination path exists +mkdir -p "`dirname $KEYDIR/$RELATIVE_PATH/$DEST`" + # Run move command keyringer_exec git "$BASEDIR" mv "keys/$RELATIVE_PATH/$ORIG" "keys/$FILE" -- cgit v1.2.3 From 18d90207bf78a8763f112ab7da9d560f0454a8a6 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 23 Oct 2016 18:24:56 -0200 Subject: Adds sclip action --- lib/keyringer/actions/sclip | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 lib/keyringer/actions/sclip (limited to 'lib') diff --git a/lib/keyringer/actions/sclip b/lib/keyringer/actions/sclip new file mode 100755 index 0000000..8f2debd --- /dev/null +++ b/lib/keyringer/actions/sclip @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +# +# Decrypt secret header to clipboard, sleep and cleanup. +# + +# Load functions +LIB="`dirname $0`/../functions" +source "$LIB" || exit 1 + +# Clip password +shift +keyringer $KEYRING xclip $* + +# Sleep +sleep 5 + +# Overwrite clipboard +cat $RANDOM | sha256sum | base64 -d | xclip -- cgit v1.2.3 From 880a35bbb1ad613255a38a228ba53a7820e11846 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 27 Oct 2016 16:20:51 -0200 Subject: Switch windows at sclip --- lib/keyringer/actions/sclip | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib') diff --git a/lib/keyringer/actions/sclip b/lib/keyringer/actions/sclip index 8f2debd..e4c88fa 100755 --- a/lib/keyringer/actions/sclip +++ b/lib/keyringer/actions/sclip @@ -11,6 +11,11 @@ source "$LIB" || exit 1 shift keyringer $KEYRING xclip $* +# Move to the next window +if which xdotool &> /dev/null; then + xdotool key alt+Tab +fi + # Sleep sleep 5 -- cgit v1.2.3