aboutsummaryrefslogtreecommitdiff
path: root/scripts/lua2dox_filter
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2022-10-11 08:28:36 +0100
committerGitHub <noreply@github.com>2022-10-11 08:28:36 +0100
commitc5347d47e1f8af1e5a23ea9a71c98ec4a0fbeaa3 (patch)
tree6f9cb37626be90a10982386d9e98566c8b3b007b /scripts/lua2dox_filter
parentd9a80b8e29182230693c9091ac397f96e7222fbb (diff)
parent3b6c7f9c7f2df493e24990c47a338ef8b46dfe8a (diff)
downloadrneovim-c5347d47e1f8af1e5a23ea9a71c98ec4a0fbeaa3.tar.gz
rneovim-c5347d47e1f8af1e5a23ea9a71c98ec4a0fbeaa3.tar.bz2
rneovim-c5347d47e1f8af1e5a23ea9a71c98ec4a0fbeaa3.zip
Merge pull request #20570 from lewis6991/refactor/lua2dox
refactor: lua2dox
Diffstat (limited to 'scripts/lua2dox_filter')
-rwxr-xr-xscripts/lua2dox_filter105
1 files changed, 51 insertions, 54 deletions
diff --git a/scripts/lua2dox_filter b/scripts/lua2dox_filter
index 0b9f59b6ac..e3fa95d0cf 100755
--- a/scripts/lua2dox_filter
+++ b/scripts/lua2dox_filter
@@ -22,72 +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 '.deps/usr/bin/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 '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 found"
- exit 1
+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}"
+
+ LUASCRIPT="${DIRNAME}/lua2dox.lua ${BASENAME}"
+ #echo "lua[${LUASCRIPT}]"
- ${EXE} ${LUASCRIPT} $@
+ ${EXE} ${LUASCRIPT} $@
fi
-#
+
##eof