summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2010-11-16 21:43:05 -0500
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>2010-11-16 21:43:05 -0500
commita2856ec97944646b04d11288a1bd15e0c238c9c3 (patch)
tree7a460bab1928f4bbc03c649ddcdf2b4e86e3beee
parent0b63a7e78a407d4a8493f5b38231ac0eed404b9e (diff)
downloadkeyringer-a2856ec97944646b04d11288a1bd15e0c238c9c3.tar.gz
keyringer-a2856ec97944646b04d11288a1bd15e0c238c9c3.tar.bz2
fall back on reasonable editors if environment variable is not set
-rw-r--r--lib/keyringer/functions11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/keyringer/functions b/lib/keyringer/functions
index 5c4b5da..9888ed1 100644
--- a/lib/keyringer/functions
+++ b/lib/keyringer/functions
@@ -187,10 +187,15 @@ function keyringer_set_env {
fi
if [ -z "$EDITOR" ]; then
- echo "You have to set EDITOR env variable"
- exit 1
+ if type sensible-editor > /dev/null 2>&1 ; then
+ EDITOR=sensible-editor
+ elif type editor > /dev/null 2>&1 ; then
+ EDITOR=editor
+ else
+ echo "You have to set EDITOR env variable"
+ exit 1
+ fi
fi
-
if [ ! -f "$OPTIONS" ]; then
echo "No option config was found"
exit 1