fixed syntax highlighting

This commit is contained in:
Emma Tebibyte 2024-06-26 18:37:03 -06:00
parent 41b0293d42
commit c0608baa7b
Signed by: emma
GPG Key ID: 06FA419A1698C270

17
en
View File

@ -16,8 +16,10 @@ fi
if test -z "$1"; then if test -z "$1"; then
set -- /dev/stdin set -- /dev/stdin
HIGHLIGHT_OPTIONS="$HIGHLIGHT_OPTIONS --syntax=none" export HIGHLIGHT_OPTIONS="$HIGHLIGHT_OPTIONS -S none"
export HIGHLIGHT_OPTIONS else
export HIGHLIGHT_OPTIONS="$HIGHLIGHT_OPTIONS -S \
$(printf '%s\n' "$1" | sed 's/^.*\.//g')"
fi fi
help="$(printf "Commands:\n\ help="$(printf "Commands:\n\
@ -70,7 +72,7 @@ while test -n "$1"; do
"c") clear ;; "c") clear ;;
"d") "d")
if test -z "$args"; then if test -z "$args"; then
printf "%s: %s: Missing argument.\n" "$0" "$command" 1>&2 printf "%s: %s: missing argument.\n" "$0" "$command" 1>&2
else else
for line in $(printf "%s\n" "$args" | sed 's/,/\n/g') for line in $(printf "%s\n" "$args" | sed 's/,/\n/g')
do do
@ -82,12 +84,9 @@ while test -n "$1"; do
"e") "e")
eval "$args" || true eval "$args" || true
;; ;;
"h") "h") export HIGHLIGHT_OPTIONS="$HIGHLIGHT_OPTIONS -S $args" ;;
HIGHLIGHT_OPTIONS="$HIGHLIGHT_OPTIONS --syntax=$args"
export HIGHLIGHT_OPTIONS
;;
"i") "i")
printf "%s: i: Command not implemented.\n" "$0" 1>&2 printf "%s: i: command not implemented.\n" "$0" 1>&2
;; ;;
"p") "p")
printf "%s\n" "$content" | highlight | nl -ba >/dev/tty printf "%s\n" "$content" | highlight | nl -ba >/dev/tty
@ -99,7 +98,7 @@ while test -n "$1"; do
"x") exit ;; "x") exit ;;
"") ;; "") ;;
*) *)
printf "%s: %s: unrecognized command\n" "$0" "$command" printf "%s: %s: unrecognized command\n%s\n" "$0" "$command" "$help"
;; ;;
esac esac
done done