aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-08-21 15:37:06 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-08-21 15:37:06 -0300
commit6ae4c3884701f31edbf84666a7b1b76dc01a1068 (patch)
treed3ded3c8c7c39849ab4dbd4bc097caa8cfa619af
parentbfd718703aac6fe706ee751f232b0e80601913d1 (diff)
downloadkeyringer-6ae4c3884701f31edbf84666a7b1b76dc01a1068.tar.gz
keyringer-6ae4c3884701f31edbf84666a7b1b76dc01a1068.tar.bz2
Shell completions: fix handling of keyrings with '-' in their names
-rw-r--r--ChangeLog4
-rw-r--r--lib/keyringer/completions/bash/keyringer3
-rw-r--r--lib/keyringer/completions/zsh/_keyringer3
3 files changed, 5 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index e9be9aa..0905d9f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,6 @@
-2014-08-16 - Silvio Rhatto <rhatto@riseup.net>
+2014-08-21 - Silvio Rhatto <rhatto@riseup.net>
+
+ Shell completions: fix handling of keyrings with '-' in their names
Edit: Unset RELATIVE_PATH before encrypting file
diff --git a/lib/keyringer/completions/bash/keyringer b/lib/keyringer/completions/bash/keyringer
index 0f2cb2b..b638418 100644
--- a/lib/keyringer/completions/bash/keyringer
+++ b/lib/keyringer/completions/bash/keyringer
@@ -69,7 +69,6 @@ _keyringer() {
fi
# Process config
- source $config/config
keyrings="`ls --color=never $config | sed -e '/^config$/d' | xargs`"
# Available instances
@@ -77,7 +76,7 @@ _keyringer() {
# The current instance
instance="${COMP_WORDS[1]}"
- path="`eval echo '$'$instance`"
+ path="`grep -e "^$instance=" "$config/config" | tail -n 1 | cut -d = -f 2 | sed -e 's/"//g' -e "s/'//g" | sed -e 's/ *#.*$//'`"
# Command completions
if [ "${#COMP_WORDS[@]}" == "2" ]; then
diff --git a/lib/keyringer/completions/zsh/_keyringer b/lib/keyringer/completions/zsh/_keyringer
index b4ccdd4..6142949 100644
--- a/lib/keyringer/completions/zsh/_keyringer
+++ b/lib/keyringer/completions/zsh/_keyringer
@@ -19,9 +19,8 @@ _keyringer() {
fi
# Process config
- source $config/config
local keyrings="`ls --color=never $config | sed -e '/^config$/d' | xargs`"
- local keyring_path="`eval echo '$'$words[2]`"
+ local keyring_path="`grep -e "^$words[2]=" "$config/config" | tail -n 1 | cut -d = -f 2 | sed -e 's/"//g' -e "s/'//g" | sed -e 's/ *#.*$//'`"
local instances="`echo $keyrings | sed -e 's/ /$\\\|^/g' -e 's/^/^/' -e 's/$/$/'`"
_arguments \