From bf99499751482886833ad7ce77930ba9a12b8a86 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 14 Nov 2013 22:57:59 -0200 Subject: Support for encrypting a whole tree (closes #21) --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 69d58bb..b55493d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-11-14 - Silvio Rhatto + + Support for encrypting a whole tree (closes #21) + 2013-11-14 - 0.2.8 Silvio Rhatto Updated development workflow and version scheme -- cgit v1.2.3 From 7d5aea9198395255062c71f2695044a8f98fc891 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sat, 16 Nov 2013 14:07:39 -0200 Subject: Misc enhancements --- ChangeLog | 8 +++++++- lib/keyringer/actions/ls | 7 +++++-- lib/keyringer/completions/bash/keyringer | 10 +++++++--- lib/keyringer/completions/zsh/_keyringer | 3 +++ lib/keyringer/functions | 2 +- 5 files changed, 23 insertions(+), 7 deletions(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index b55493d..d287171 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,10 @@ -2013-11-14 - Silvio Rhatto +2013-11-16 - Silvio Rhatto + + Shell completion enhancements. + + Fixing keyringer_has_action() to correctly handle "/" and ".". + + Action ls now supports leading slash ("/"). Support for encrypting a whole tree (closes #21) diff --git a/lib/keyringer/actions/ls b/lib/keyringer/actions/ls index ec8080b..61facc8 100755 --- a/lib/keyringer/actions/ls +++ b/lib/keyringer/actions/ls @@ -10,7 +10,10 @@ source "$LIB" || exit 1 # Aditional parameters CWD="`pwd`" -# Run list command +# Avoid trailing slash shift -cd "$KEYDIR" && ls $* +ARGS="`echo "$*" | sed -e "s|^/*||"`" + +# Run list command +cd "$KEYDIR" && ls $ARGS cd "$CWD" diff --git a/lib/keyringer/completions/bash/keyringer b/lib/keyringer/completions/bash/keyringer index 7bfa62f..88c85cf 100644 --- a/lib/keyringer/completions/bash/keyringer +++ b/lib/keyringer/completions/bash/keyringer @@ -46,11 +46,12 @@ _keyringer_git_complete() { function _keyringer_path_complete() { # Thanks http://unix.stackexchange.com/questions/55520/create-bash-completion-script-to-autocomplete-paths-after-is-equal-sign cur=${1//\\ / } - [[ ${cur} == "~/"* ]] && cur=${cur/\~/$HOME} + [[ ${cur} == "~"* ]] && cur=${cur/\~/$HOME} echo ${cur} } +# Main completion _keyringer() { # Standard stuff local cur prev command config path keyrings instances instance opts @@ -94,6 +95,7 @@ _keyringer() { opts="ls edit" ;; ls|encrypt|encrypt-batch|decrypt|edit|append|append-batch|del|recrypt|open) + cur="`echo ${cur} | sed -e "s|^/*||"`" # avoid trailing slash opts="$(bash -c "set -f && export KEYRINGER_CHECK_VERSION=false && keyringer $instance ls -p -d ${cur}*" 2> /dev/null)" ;; genpair) @@ -104,7 +106,7 @@ _keyringer() { ;; init) cur="$(_keyringer_path_complete ${cur})" - opts="$(compgen -o dirnames ${cur})" + opts="`compgen -o default "${cur}"`" ;; *) ;; @@ -112,9 +114,11 @@ _keyringer() { elif [ "${#COMP_WORDS[@]}" == "5" ]; then case "${command}" in recipients) + cur="`echo ${cur} | sed -e "s|^/*||"`" # avoid trailing slash opts="$(cd $path/config/recipients && ls --color=never -p ${cur}* 2> /dev/null)" ;; genpair) + cur="`echo ${cur} | sed -e "s|^/*||"`" # avoid trailing slash opts="$(bash -c "set -f && export KEYRINGER_CHECK_VERSION=false && keyringer $instance ls -p -d ${cur}*" 2> /dev/null)" ;; git) @@ -123,7 +127,7 @@ _keyringer() { ;; encrypt|encrypt-batch) cur="$(_keyringer_path_complete ${cur})" - opts="$(compgen -o dirnames ${cur})" + opts="`compgen -o default "${cur}"`" ;; *) ;; diff --git a/lib/keyringer/completions/zsh/_keyringer b/lib/keyringer/completions/zsh/_keyringer index 50ff433..ac31879 100644 --- a/lib/keyringer/completions/zsh/_keyringer +++ b/lib/keyringer/completions/zsh/_keyringer @@ -51,6 +51,7 @@ _keyringer() { compadd "$@" ls edit ;; ls|encrypt|encrypt-batch|decrypt|edit|append|append-batch|del|recrypt|open) + words[4]="`echo $words[4] | sed -e "s|^/*||"`" # avoid trailing slash compadd "$@" $(KEYRINGER_CHECK_VERSION=false keyringer $words[2] ls -p -d $words[4]'*' 2> /dev/null) ;; genpair) @@ -69,9 +70,11 @@ _keyringer() { misc) case "$words[3]" in recipients) + words[5]="$(echo $words[5] | sed -e "s|^/||")" # TODO: avoid trailing slash compadd "$@" $(cd $keyring_path/config/recipients && ls --color=never -p $words[5]'*' 2> /dev/null) ;; genpair) + words[5]="$(echo $words[5] | sed -e "s|^/||")" # TODO: avoid trailing slash compadd "$@" $(KEYRINGER_CHECK_VERSION=false keyringer $words[2] ls -p -d $words[5]'*' 2> /dev/null) ;; git) diff --git a/lib/keyringer/functions b/lib/keyringer/functions index dd31676..7b96d6f 100755 --- a/lib/keyringer/functions +++ b/lib/keyringer/functions @@ -59,7 +59,7 @@ function keyringer_has_action { exit 1 fi - if [ -e "$ACTIONS/$1" ]; then + if [ -e "$ACTIONS/$1" ] && [ ! -d "$ACTIONS/$1" ]; then true else false -- cgit v1.2.3 From 6f768ce30e5218ca983178a73cf1d0c90c922e75 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Mon, 25 Nov 2013 23:11:31 -0200 Subject: ChangeLog update --- ChangeLog | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index d287171..d4f6ab0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,12 @@ -2013-11-16 - Silvio Rhatto +2013-11-25 - Silvio Rhatto + + Fixed minor typos + + Man page update + + Temp folder priority set to "$TMPDIR $TMP /tmpĀ /run/shm" + + Avoid bash arrays on append action (closes #26) Shell completion enhancements. -- cgit v1.2.3 From 00dbdc632128a719de9adfab62ba7380620dd964 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 26 Nov 2013 13:31:37 -0200 Subject: ChangeLog update --- ChangeLog | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index d4f6ab0..9fe7aa5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,12 @@ -2013-11-25 - Silvio Rhatto +2013-11-26 - Silvio Rhatto + + Set .gitignore during initialization and when using tmp inside the repository + + Pass options to git-rm at del action + + Simpler ramdisk/tmpfs check at keyringer_check_tmp + + Better mode check on keyringer_check_tmp (closes #30) Fixed minor typos -- cgit v1.2.3 From 17bfa3c574c8a44614053410edf06791cb432dbc Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 26 Nov 2013 16:18:55 -0200 Subject: New actions: tree and rm (alias for del) --- ChangeLog | 4 ++++ lib/keyringer/actions/rm | 1 + lib/keyringer/actions/tree | 19 +++++++++++++++++++ lib/keyringer/completions/bash/keyringer | 2 +- lib/keyringer/completions/zsh/_keyringer | 2 +- share/man/keyringer.1.mdwn | 8 ++++++++ 6 files changed, 34 insertions(+), 2 deletions(-) create mode 120000 lib/keyringer/actions/rm create mode 100755 lib/keyringer/actions/tree (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 9fe7aa5..343d7d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2013-11-26 - Silvio Rhatto + Added 'tree' action + + Added 'rm' alias to 'del' action + Set .gitignore during initialization and when using tmp inside the repository Pass options to git-rm at del action diff --git a/lib/keyringer/actions/rm b/lib/keyringer/actions/rm new file mode 120000 index 0000000..1a7ac23 --- /dev/null +++ b/lib/keyringer/actions/rm @@ -0,0 +1 @@ +del \ No newline at end of file diff --git a/lib/keyringer/actions/tree b/lib/keyringer/actions/tree new file mode 100755 index 0000000..2033abd --- /dev/null +++ b/lib/keyringer/actions/tree @@ -0,0 +1,19 @@ +#!/bin/bash +# +# List keys. +# + +# Load functions +LIB="`dirname $0`/../functions" +source "$LIB" || exit 1 + +# Aditional parameters +CWD="`pwd`" + +# Avoid leading slash +shift +ARGS="`echo "$*" | sed -e "s|^/*||"`" + +# Run list command +cd "$KEYDIR" && tree $ARGS +cd "$CWD" diff --git a/lib/keyringer/completions/bash/keyringer b/lib/keyringer/completions/bash/keyringer index bbd49f5..eeda27f 100644 --- a/lib/keyringer/completions/bash/keyringer +++ b/lib/keyringer/completions/bash/keyringer @@ -94,7 +94,7 @@ _keyringer() { recipients) opts="ls edit" ;; - ls|encrypt|encrypt-batch|decrypt|edit|append|append-batch|del|recrypt|open) + ls|tree|encrypt|encrypt-batch|decrypt|edit|append|append-batch|del|rm|recrypt|open) cur="`echo ${cur} | sed -e "s|^/*||"`" # avoid leading slash opts="$(bash -c "set -f && export KEYRINGER_CHECK_VERSION=false && keyringer $instance ls -p -d ${cur}*" 2> /dev/null)" ;; diff --git a/lib/keyringer/completions/zsh/_keyringer b/lib/keyringer/completions/zsh/_keyringer index 5d0a64c..5717b00 100644 --- a/lib/keyringer/completions/zsh/_keyringer +++ b/lib/keyringer/completions/zsh/_keyringer @@ -50,7 +50,7 @@ _keyringer() { recipients) compadd "$@" ls edit ;; - ls|encrypt|encrypt-batch|decrypt|edit|append|append-batch|del|recrypt|open) + ls|tree|encrypt|encrypt-batch|decrypt|edit|append|append-batch|del|rm|recrypt|open) words[4]="`echo $words[4] | sed -e "s|^/*||"`" # avoid leading slash compadd "$@" $(KEYRINGER_CHECK_VERSION=false keyringer $words[2] ls -p -d $words[4]'*' 2> /dev/null) ;; diff --git a/share/man/keyringer.1.mdwn b/share/man/keyringer.1.mdwn index d2156d8..d4b71e3 100644 --- a/share/man/keyringer.1.mdwn +++ b/share/man/keyringer.1.mdwn @@ -56,6 +56,11 @@ ls <*path*> if *path* is specified. Like the git wrapper, this is a wrapper around the *LS(1)* command. +tree <*path*> +: List contents from the toplevel repository *keys* folder or from relative paths + if *path* is specified using a tree-like format. Like the ls wrapper, this is a + wrapper around the *TREE(1)* command. + # SECRET MANIPULATION ACTIONS All secret manipulation actions operate upon a *secret* which is the pathname @@ -88,6 +93,9 @@ del <*secret*> To completely remove a file from a keyring, you should also rewrite the Git history yourself. +rm <*secret*> +: Alias for *del* action. + edit <*secret*> : Edit a secret by temporarily decrypting it, opening the decrypted copy into the text editor defined by the *$EDITOR* environment variable and then re-encrypting it. -- cgit v1.2.3 From 0358ba548d9d3aaaeb23984e092318522238bca9 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 26 Nov 2013 16:52:09 -0200 Subject: Keyringer 0.2.9 --- ChangeLog | 2 +- keyringer | 2 +- share/man/keyringer.1 | 13 +++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 343d7d6..9cc7bb2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -2013-11-26 - Silvio Rhatto +2013-11-26 - 0.2.9 Silvio Rhatto Added 'tree' action diff --git a/keyringer b/keyringer index 922f490..11b8aa1 100755 --- a/keyringer +++ b/keyringer @@ -120,7 +120,7 @@ function keyringer_dispatch { # Config NAME="keyringer" -KEYRINGER_VERSION="0.2.8" +KEYRINGER_VERSION="0.2.9" CONFIG_VERSION="0.1" CONFIG_BASE="$HOME/.$NAME" CONFIG="$CONFIG_BASE/config" diff --git a/share/man/keyringer.1 b/share/man/keyringer.1 index 35755ae..c0fed1c 100644 --- a/share/man/keyringer.1 +++ b/share/man/keyringer.1 @@ -59,6 +59,14 @@ Like the git wrapper, this is a wrapper around the \f[I]LS(1)\f[] command. .RS .RE +.TP +.B tree <\f[I]path\f[]> +List contents from the toplevel repository \f[I]keys\f[] folder or from +relative paths if \f[I]path\f[] is specified using a tree-like format. +Like the ls wrapper, this is a wrapper around the \f[I]TREE(1)\f[] +command. +.RS +.RE .SH SECRET MANIPULATION ACTIONS .PP All secret manipulation actions operate upon a \f[I]secret\f[] which is @@ -102,6 +110,11 @@ Git history.\f[] To completely remove a file from a keyring, you should also rewrite the Git history yourself. .RE .TP +.B rm <\f[I]secret\f[]> +Alias for \f[I]del\f[] action. +.RS +.RE +.TP .B edit <\f[I]secret\f[]> Edit a secret by temporarily decrypting it, opening the decrypted copy into the text editor defined by the \f[I]$EDITOR\f[] environment -- cgit v1.2.3