aboutsummaryrefslogtreecommitdiff
path: root/lib/keyringer/functions
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-11-03 10:55:26 -0200
committerSilvio Rhatto <rhatto@riseup.net>2017-11-03 10:55:26 -0200
commitb6dec4f1efe948f01df02b364cbb7f7aeedaa2b1 (patch)
tree0a51277f829b08b792204c8b4fe06c33bff4591a /lib/keyringer/functions
parent374887922e7018e6b0c8e3d2ba8f52d4386ec682 (diff)
parent7fca7cd0433e6f97080ecf12bee64ec4f38948ba (diff)
downloadkeyringer-b6dec4f1efe948f01df02b364cbb7f7aeedaa2b1.tar.gz
keyringer-b6dec4f1efe948f01df02b364cbb7f7aeedaa2b1.tar.bz2
Merge branch 'develop'
Diffstat (limited to 'lib/keyringer/functions')
-rwxr-xr-xlib/keyringer/functions13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/keyringer/functions b/lib/keyringer/functions
index 0d96288..6f9a5e3 100755
--- a/lib/keyringer/functions
+++ b/lib/keyringer/functions
@@ -293,7 +293,7 @@ function keyringer_set_env {
fi
# Avoid viminfo, see https://keyringer.pw/trac/ticket/50
- if $EDITOR --help | grep -q -e "^VIM"; then
+ if $EDITOR --help 2>&1 | grep -q -e "^VIM"; then
if ! echo $EDITOR | grep -q -- "-i NONE"; then
EDITOR="$EDITOR -S $SHARE/editors/vim"
fi
@@ -537,7 +537,12 @@ function keyringer_show_actions {
# Usage
function keyringer_usage {
- local keyrings="$(ls --color=never `dirname $CONFIG` | sed -e 's/config//' | xargs)"
+ # are we're using an `ls` that supports `--color`?
+ if ls --version > /dev/null 2>&1; then
+ local keyrings="$(ls --color=never `dirname $CONFIG` | sed -e 's/config//' | xargs)"
+ else
+ local keyrings="$(ls `dirname $CONFIG` | sed -e 's/config//' | xargs)"
+ fi
printf "Keyringer $KEYRINGER_VERSION\n"
printf "Usage: keyringer <keyring> <action> [arguments]\n\n"
@@ -552,7 +557,9 @@ function keyringer_usage {
if [ ! -z "$keyrings" ] && [ -z "$1" ]; then
printf "\tinit <path> [remote]\n" $BASENAME
fi
- keyringer_show_actions | sed -e 's/^/\t/'
+ # \t is a GNU extension
+ # https://stackoverflow.com/questions/8400602/sed-replace-literal-tab
+ keyringer_show_actions | sed -e "`printf 's/^/\t/'`"
printf "\n"
}