From a2856ec97944646b04d11288a1bd15e0c238c9c3 Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Tue, 16 Nov 2010 21:43:05 -0500 Subject: fall back on reasonable editors if environment variable is not set --- lib/keyringer/functions | 11 ++++++++--- 1 file 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 -- cgit v1.2.3