40 lines
749 B
Bash
Executable File
40 lines
749 B
Bash
Executable File
#!/bin/sh
|
|
|
|
if [ $# -ne 0 ]; then
|
|
cat<<EOF>&2
|
|
Usage: ${0##*/}
|
|
|
|
A therme vierwer for 'highlight', a listing pretty-printer.
|
|
|
|
This script runs over every single theme. A 256-color terminal is required.
|
|
|
|
EOF
|
|
exit
|
|
fi
|
|
|
|
if ! command -v highlight >/dev/null 2>&1; then
|
|
echo >&2 "'highlight' not found"
|
|
exit 1
|
|
fi
|
|
|
|
SAMPLE="$(cat <<EOF
|
|
void function(char *pointer, int &ref) {
|
|
int integer=3;
|
|
char* string="Hello!";
|
|
|
|
// Line comment
|
|
for (i=0; i<10; i++)
|
|
{
|
|
printf("Sum: %d\n", i*( integer+14 ) );
|
|
}
|
|
}
|
|
EOF
|
|
)"
|
|
|
|
echo "Press ENTER to view next, Ctrl-c to exit."
|
|
for i in $(highlight -w | awk '!flag && NF == 1 {flag=1; print; next} !flag {next} NF != 1 {exit} 1'); do
|
|
echo "==> $i"
|
|
echo "$SAMPLE" | highlight -S c -O xterm256 -s "$i"
|
|
read DUMMY
|
|
done
|