diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2016-03-14 20:59:23 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2016-03-14 20:59:23 +0000 |
| commit | 09baf73152e3fe61acc781ec0b6264a02ab9cdc8 (patch) | |
| tree | cbf3c91568e7b37d4115bb039f9ce3143f073e0b | |
| parent | dca9bccc6ac7fb1bb676d193bc22376a2e7082e3 (diff) | |
Fix various posix shell compliance issues in the rc/ files
| -rw-r--r-- | rc/core/man.kak | 4 | ||||
| -rw-r--r-- | rc/extra/clang.kak | 2 | ||||
| -rw-r--r-- | rc/extra/git-tools.kak | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/rc/core/man.kak b/rc/core/man.kak index 27dae843..82de8b1a 100644 --- a/rc/core/man.kak +++ b/rc/core/man.kak @@ -37,7 +37,7 @@ def -hidden -params .. _man %{ %sh{ def -params .. \ -shell-completion %{ - prefix=${1:0:${kak_pos_in_token}} + prefix=$(echo "$1" | cut -c1-${kak_pos_in_token} 2>/dev/null) for page in /usr/share/man/*/${prefix}*.[1-8]*; do candidate=$(basename ${page%%.[1-8]*}) pagenum=$(printf %s "$page" | sed -r 's,^.+/.+\.([1-8][^.]*)\..+$,\1,') @@ -52,7 +52,7 @@ def -params .. \ pagenum="" ## The completion suggestions display the page number, strip them if present - if [[ $subject =~ [a-zA-Z_-]+\([^\)]+\) ]]; then + if expr "$subject" : '[a-zA-Z_-]+\([^\)]+\)'; then pagenum=${subject##*\(} pagenum=${pagenum:0:$((${#pagenum} - 1))} subject=${subject%%\(*} diff --git a/rc/extra/clang.kak b/rc/extra/clang.kak index ce9e09d1..0043cb51 100644 --- a/rc/extra/clang.kak +++ b/rc/extra/clang.kak @@ -37,7 +37,7 @@ def clang-parse -params 0..1 -docstring "Parse the contents of the current buffe *) ft=c++ ;; esac - if [ "$1" == "-complete" ]; then + if [ "$1" = "-complete" ]; then pos=-:${kak_cursor_line}:${kak_cursor_column} header="${kak_cursor_line}.${kak_cursor_column}@${kak_timestamp}" compl=$(clang++ -x ${ft} -fsyntax-only ${kak_opt_clang_options} \ diff --git a/rc/extra/git-tools.kak b/rc/extra/git-tools.kak index 3d77e88b..080530c7 100644 --- a/rc/extra/git-tools.kak +++ b/rc/extra/git-tools.kak @@ -29,7 +29,7 @@ def -params 1.. \ -docstring %sh{printf "%%{Git wrapping helper\navailable commands:\n add\n rm\n blame\n commit\n checkout\n diff\n hide-blame\n log\n show\n show-diff\n status\n update-diff}"} \ -shell-completion %{ shift $(expr ${kak_token_to_complete}) - prefix=${1:0:${kak_pos_in_token}} + prefix=$(echo "${1}" | cut -c1-${kak_pos_in_token} 2>/dev/null) ( for cmd in add rm blame commit checkout diff hide-blame log show show-diff status update-diff; do expr "${cmd}" : "^\(${prefix}.*\)$" |
