Compare commits

..

No commits in common. "91bfd4eea426b25ff366ef43a1bcebad76f45f3f" and "9242bbfa6c9ebb6b8bcccaaff5e6fc20bf66ee1c" have entirely different histories.

3 changed files with 24 additions and 8 deletions

14
en
View File

@ -12,13 +12,13 @@ exec >&2 </dev/tty
if test -z "$1"; then
printf "Usage: %s file...\n" "$argv0" 1>&2
exit 64 # sysexits.h(3) EX_USAGE
exit 1
fi
if ! command -v mktemp >/dev/null 2>&1
then
printf "%s: mktemp(1): Missing dependency." "$argv0"
exit 69 # sysexits.h(3) EX_UNAVAILABLE
exit 1
fi
help="$(printf "Commands:\n\
@ -39,13 +39,13 @@ en(1) Copyright (c) 2023 Emma Tebibyte\n")"
while test -n "$1"; do
content="$(cat "$1")"
file="$(printf "%s\n" "$1" | tr -d '/')"
temp_highlight="$(mktemp -t "XXXXX$file")"
# use bat for syntax highlighting if its available, but remove the frills
if command -v bat >/dev/null
then
# there has to be a temp file for writing the highlighted text to
syntax_h() {
temp_highlight="$(mktemp -t "XXXXX$file")"
printf "%s\n" "$1" >"$temp_highlight"
bat -pp --color always "$temp_highlight"
}
@ -66,7 +66,7 @@ while test -n "$1"; do
;;
"a")
read -r append
content="$content$append"
content="$(printf "%s\n%s" "$content" "$append")"
;;
"c")
clear
@ -77,10 +77,8 @@ while test -n "$1"; do
else
for line in $(printf "%s\n" "$args" | sed 's/,/\n/g')
do
content="$(printf "%s\n" "$content" |\
awk -v l="$line" 'NR == l {next} {print}')"
#del="$(printf "%s\n" "$content" | head -n "$line" | tail -n 1)"
#content="$(printf "%s\n" "$content" | sed -n "/$del/!p")"
del="$(printf "%s\n" "$content" | head -n "$line" | tail -n 1)"
content="$(printf "%s\n" "$content" | sed -n "/$del/!p")"
done
fi
;;

0
xx00 Normal file
View File

18
xx01 Normal file
View File

@ -0,0 +1,18 @@
1
2
3
4
5
6
7
8
this is a test file.
it is very useful for testing things.
meow
meow
meow meow
woof
test