mirror of
https://github.com/koreader/koreader
synced 2024-11-10 01:10:34 +00:00
f2557a7aa6
New real terminal emulator, replacing the old plugin. The emulator is basically a vt52 terminal (enriched with some ANSI-sequences, as ash, vi and mksh don't behave well on a vt52 term). So far working: ash, mksh, bash, nano, vi, busybox, watch... The input supports: tab-completion; cursor movement; backspace; start of line, end of line (long press); page up, page down (long press). User scripts may be placed in the koterm.koplugin/scripts/ folder, aliases can be put in the file aliases and startup command in the file profile.user in that folder.
33 lines
1.5 KiB
Bash
Executable File
33 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
# shellcheck source=/dev/null
|
|
source "${CI_DIR}/common.sh"
|
|
|
|
# shellcheck disable=2016
|
|
mapfile -t shellscript_locations < <({ git grep -lE '^#!(/usr)?/bin/(env )?(bash|sh)' | sed "/^plugins\/terminal.koplugin\/shfm$/d" && git submodule --quiet foreach '[ "$path" = "base" -o "$path" = "platform/android/luajit-launcher" ] || git grep -lE "^#!(/usr)?/bin/(env )?(bash|sh)" | sed "s|^|$path/|"' && git ls-files ./*.sh; } | sort | uniq)
|
|
|
|
SHELLSCRIPT_ERROR=0
|
|
SHFMT_OPTIONS="-i 4 -ci"
|
|
|
|
for shellscript in "${shellscript_locations[@]}"; do
|
|
echo -e "${ANSI_GREEN}Running shellcheck on ${shellscript}"
|
|
shellcheck "${shellscript}" || SHELLSCRIPT_ERROR=1
|
|
echo -e "${ANSI_GREEN}Running shfmt on ${shellscript}"
|
|
# shellcheck disable=2086
|
|
if ! shfmt ${SHFMT_OPTIONS} -kp "${shellscript}" >/dev/null 2>&1; then
|
|
echo -e "${ANSI_RED}Warning: ${shellscript} contains the following problem:"
|
|
# shellcheck disable=2086
|
|
shfmt ${SHFMT_OPTIONS} -kp "${shellscript}" || SHELLSCRIPT_ERROR=1
|
|
continue
|
|
fi
|
|
# shellcheck disable=2086
|
|
if [ "$(cat "${shellscript}")" != "$(shfmt ${SHFMT_OPTIONS} "${shellscript}")" ]; then
|
|
echo -e "${ANSI_RED}Warning: ${shellscript} does not abide by coding style, diff for expected style:"
|
|
# shellcheck disable=2086
|
|
shfmt ${SHFMT_OPTIONS} -d "${shellscript}" || SHELLSCRIPT_ERROR=1
|
|
fi
|
|
done
|
|
|
|
exit "${SHELLSCRIPT_ERROR}"
|