]> gitweb.fluxo.info Git - keyringer.git/commitdiff
fall back on reasonable editors if environment variable is not set
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Wed, 17 Nov 2010 02:43:05 +0000 (21:43 -0500)
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Wed, 17 Nov 2010 02:43:05 +0000 (21:43 -0500)
lib/keyringer/functions

index 5c4b5da8ea169db63dfc89c051bf68140501927c..9888ed1a199baeb7449f1207c0b31800f2915cf2 100644 (file)
@@ -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