mirror of
https://github.com/koreader/koreader
synced 2024-11-13 19:11:25 +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.
36 lines
590 B
Bash
Executable File
36 lines
590 B
Bash
Executable File
#!/bin/sh -e
|
|
#
|
|
# open file in application based on file extension
|
|
|
|
mime_type=$(file -bi "$1")
|
|
|
|
case "${mime_type}" in
|
|
application/x*)
|
|
./"$1"
|
|
echo "Application done, hit enter to return"
|
|
read -r
|
|
exit
|
|
;;
|
|
|
|
text/x-shellscript*)
|
|
./"$1"
|
|
echo "Shellscript done, hit enter to return"
|
|
read -r
|
|
exit
|
|
;;
|
|
esac
|
|
|
|
case "$1" in
|
|
*.sh)
|
|
sh "$1"
|
|
echo "Shellscript done, enter to return."
|
|
read -r
|
|
exit
|
|
;;
|
|
|
|
# all other files
|
|
*)
|
|
"${EDITOR:=vi}" "$1"
|
|
;;
|
|
esac
|