summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-08-16 23:13:28 -0300
committerSilvio Rhatto <rhatto@riseup.net>2013-08-16 23:13:28 -0300
commit48444f3a7b5971f6285d8c891d2bfd27baa772c7 (patch)
tree59ac4768432ab824a5e397c2cd335c2b3944fe5b /lib
parent004f0b0f950d0c8e43e2a4d59638fa152138dc71 (diff)
downloadkeyringer-48444f3a7b5971f6285d8c891d2bfd27baa772c7.tar.gz
keyringer-48444f3a7b5971f6285d8c891d2bfd27baa772c7.tar.bz2
Check config before completion
Diffstat (limited to 'lib')
-rw-r--r--lib/keyringer/completions/bash/keyringer7
-rw-r--r--lib/keyringer/completions/zsh/_keyringer7
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/keyringer/completions/bash/keyringer b/lib/keyringer/completions/bash/keyringer
index 4459b34..e33977a 100644
--- a/lib/keyringer/completions/bash/keyringer
+++ b/lib/keyringer/completions/bash/keyringer
@@ -44,11 +44,16 @@ _keyringer() {
# Initial options
config="$HOME/.keyringer"
- keyrings="`ls $config | sed -e 's/config//'`"
+
+ # Check if we have initial configuration
+ if [ ! -d "$config" ]; then
+ return
+ fi
# Process config
source $config/config
path="`eval echo '$'$instance`"
+ keyrings="`ls $config | sed -e 's/config//'`"
# Available instances
instances="`echo $keyrings | sed -e 's/ /|/'`"
diff --git a/lib/keyringer/completions/zsh/_keyringer b/lib/keyringer/completions/zsh/_keyringer
index 3aba2b3..b8f9d31 100644
--- a/lib/keyringer/completions/zsh/_keyringer
+++ b/lib/keyringer/completions/zsh/_keyringer
@@ -33,6 +33,13 @@ _keyringer() {
# Initial options
local config="$HOME/.keyringer"
+
+ # Check if we have initial configuration
+ if [ ! -d "$config" ]; then
+ return
+ fi
+
+ # Process config
local keyrings="`ls $config | sed -e 's/config//'`"
_arguments \