diff options
author | Josh Rahm <rahm@google.com> | 2022-10-11 19:00:52 +0000 |
---|---|---|
committer | Josh Rahm <rahm@google.com> | 2022-10-11 19:00:52 +0000 |
commit | 21e2e46242033c7aaa6ccfb23e256680816c063c (patch) | |
tree | f089522cfb145d6e9c8a86a01d8e454ce5501e20 /scripts/lua2dox_filter | |
parent | 179d3ed87b17988f5fe00d8b99f2611a28212be7 (diff) | |
parent | 760b399f6c0c6470daa0663752bd22886997f9e6 (diff) | |
download | rneovim-floattitle.tar.gz rneovim-floattitle.tar.bz2 rneovim-floattitle.zip |
Merge remote-tracking branch 'upstream/master' into floattitlefloattitle
Diffstat (limited to 'scripts/lua2dox_filter')
-rwxr-xr-x | scripts/lua2dox_filter | 102 |
1 files changed, 52 insertions, 50 deletions
diff --git a/scripts/lua2dox_filter b/scripts/lua2dox_filter index 22484a807f..e3fa95d0cf 100755 --- a/scripts/lua2dox_filter +++ b/scripts/lua2dox_filter @@ -22,67 +22,69 @@ LANG="" ##! \brief test executable to see if it exists -test_executable(){ - P_EXE="$1" - ######### - WHICH=`which ${P_EXE}` - if test -z "${WHICH}" - then - echo "not found \"${P_EXE}\"" - else - EXE="${P_EXE}" - fi - } +test_executable() { + P_EXE="$1" + ######### + WHICH=$(which "$P_EXE") + if test -z "${WHICH}"; then + echo "not found \"${P_EXE}\"" + else + EXE="${P_EXE}" + fi +} ##! \brief sets the lua interpreter -set_lua(){ - if test -z "${EXE}"; then - test_executable 'luajit' - fi +set_lua() { + if test -z "${EXE}"; then + test_executable '.deps/usr/bin/luajit' + fi + + if test -z "${EXE}"; then + test_executable 'luajit' + fi - if test -z "${EXE}"; then - test_executable 'lua' - fi + if test -z "${EXE}"; then + test_executable 'lua' + fi } ##! \brief makes canonical name of file -##! +##! ##! Note that "readlink -f" doesn't work in MacOSX -##! -do_readlink(){ - pushd . > /dev/null - TARGET_FILE=$1 - - cd `dirname $TARGET_FILE` - TARGET_FILE=`basename $TARGET_FILE` - - # Iterate down a (possible) chain of symlinks - while [ -L "$TARGET_FILE" ] - do - TARGET_FILE=`readlink $TARGET_FILE` - cd `dirname $TARGET_FILE` - TARGET_FILE=`basename $TARGET_FILE` - done - - PHYS_DIR=`pwd -P` - RESULT=$PHYS_DIR - popd > /dev/null - } +##! +do_readlink() { + pushd . > /dev/null + TARGET_FILE=$1 + + cd "$(dirname $TARGET_FILE)" + TARGET_FILE=$(basename "$TARGET_FILE") + + # Iterate down a (possible) chain of symlinks + while [ -L "$TARGET_FILE" ]; do + TARGET_FILE=$(readlink "$TARGET_FILE") + cd $(dirname "$TARGET_FILE") + TARGET_FILE=$(basename "$TARGET_FILE") + done + + PHYS_DIR=$(pwd -P) + RESULT=$PHYS_DIR + popd > /dev/null +} ##main set_lua -if test -z "${EXE}" -then - echo "no lua interpreter available" +if test -z "${EXE}"; then + echo "no lua interpreter found" + exit 1 else - BASENAME=`basename "$0"` - do_readlink "$0" - DIRNAME="${RESULT}" - - LUASCRIPT="${DIRNAME}/lua2dox.lua ${BASENAME}" - #echo "lua[${LUASCRIPT}]" + BASENAME=$(basename "$0") + do_readlink "$0" + DIRNAME="${RESULT}" - ${EXE} ${LUASCRIPT} $@ + LUASCRIPT="${DIRNAME}/lua2dox.lua ${BASENAME}" + #echo "lua[${LUASCRIPT}]" + + ${EXE} ${LUASCRIPT} $@ fi -# + ##eof |