mirror of
https://github.com/tests-always-included/mo.git
synced 2024-12-18 16:27:52 +00:00
Updating to match newer version of shellcheck
This commit is contained in:
parent
8238e144fd
commit
57663d7d34
17
mo
17
mo
@ -78,6 +78,7 @@ mo() (
|
|||||||
f2source="${1#--source=}"
|
f2source="${1#--source=}"
|
||||||
|
|
||||||
if [[ -f "$f2source" ]]; then
|
if [[ -f "$f2source" ]]; then
|
||||||
|
# shellcheck disable=SC1090
|
||||||
. "$f2source"
|
. "$f2source"
|
||||||
else
|
else
|
||||||
echo "No such file: $f2source" >&2
|
echo "No such file: $f2source" >&2
|
||||||
@ -120,7 +121,7 @@ mo() (
|
|||||||
#
|
#
|
||||||
# Returns nothing.
|
# Returns nothing.
|
||||||
moFindEndTag() {
|
moFindEndTag() {
|
||||||
local content scanned standaloneBytes tag
|
local content remaining scanned standaloneBytes tag
|
||||||
|
|
||||||
#: Find open tags
|
#: Find open tags
|
||||||
scanned=""
|
scanned=""
|
||||||
@ -139,7 +140,7 @@ moFindEndTag() {
|
|||||||
moTrimWhitespace tag "${tag:1}"
|
moTrimWhitespace tag "${tag:1}"
|
||||||
moFindEndTag content "${content[2]}" "$tag" "loop"
|
moFindEndTag content "${content[2]}" "$tag" "loop"
|
||||||
scanned="${scanned}${content[0]}${content[1]}"
|
scanned="${scanned}${content[0]}${content[1]}"
|
||||||
content=${content[2]}
|
remaining=${content[2]}
|
||||||
;;
|
;;
|
||||||
|
|
||||||
'/'*)
|
'/'*)
|
||||||
@ -163,17 +164,17 @@ moFindEndTag() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
scanned="$scanned${content[1]}"
|
scanned="$scanned${content[1]}"
|
||||||
content=${content[2]}
|
remaining=${content[2]}
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
#: Ignore all other tags
|
#: Ignore all other tags
|
||||||
scanned="${scanned}${content[0]}${content[1]}"
|
scanned="${scanned}${content[0]}${content[1]}"
|
||||||
content=${content[2]}
|
remaining=${content[2]}
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
moSplit content "$content" '{{' '}}'
|
moSplit content "$remaining" '{{' '}}'
|
||||||
done
|
done
|
||||||
|
|
||||||
#: Did not find our closing tag
|
#: Did not find our closing tag
|
||||||
@ -674,7 +675,7 @@ moPartial() {
|
|||||||
# Execute in subshell to preserve current cwd and environment
|
# Execute in subshell to preserve current cwd and environment
|
||||||
(
|
(
|
||||||
# TODO: Remove dirname and use a function instead
|
# TODO: Remove dirname and use a function instead
|
||||||
cd "$(dirname -- "$moFilename")"
|
cd "$(dirname -- "$moFilename")" || exit 1
|
||||||
moIndentLines moPartial "$moIndent" "$(
|
moIndentLines moPartial "$moIndent" "$(
|
||||||
moLoadFile moPartial "${moFilename##*/}"
|
moLoadFile moPartial "${moFilename##*/}"
|
||||||
|
|
||||||
@ -893,10 +894,10 @@ moUsage() {
|
|||||||
|
|
||||||
|
|
||||||
# Save the original command's path for usage later
|
# Save the original command's path for usage later
|
||||||
MO_ORIGINAL_COMMAND="$(cd "${BASH_SOURCE%/*}"; pwd)/${BASH_SOURCE##*/}"
|
MO_ORIGINAL_COMMAND="$(cd "${BASH_SOURCE%/*}" || exit 1; pwd)/${BASH_SOURCE##*/}"
|
||||||
|
|
||||||
# If sourced, load all functions.
|
# If sourced, load all functions.
|
||||||
# If executed, perform the actions as expected.
|
# If executed, perform the actions as expected.
|
||||||
if [[ "$0" == "$BASH_SOURCE" ]] || ! [[ -n "$BASH_SOURCE" ]]; then
|
if [[ "$0" == "${BASH_SOURCE[0]}" ]] || ! [[ -n "${BASH_SOURCE[0]}" ]]; then
|
||||||
mo "$@"
|
mo "$@"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user