diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2017-11-03 11:03:39 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2017-11-03 11:03:39 -0200 |
commit | 6c62a1906b59e4ab8eb3475ebfe3c3b7cfa67f0b (patch) | |
tree | ee989361e1451ed2980270d8fb70c0ed4bd3dda7 /lib/keyringer/functions | |
parent | 5f0fb30328d9b37ee53aafd65690a1ee90ea6799 (diff) | |
parent | 7fca7cd0433e6f97080ecf12bee64ec4f38948ba (diff) | |
download | keyringer-49d56fc959ee40c8edcd7cd78ba68425b882630f.tar.gz keyringer-49d56fc959ee40c8edcd7cd78ba68425b882630f.tar.bz2 |
New upstream version 0.5.2upstream_keyringer_0.5.2
Diffstat (limited to 'lib/keyringer/functions')
-rwxr-xr-x | lib/keyringer/functions | 13 |
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" } |