Last active
November 19, 2017 06:47
-
-
Save dantiel/c59cbb3b4435594fa6fbf25cf11fd28e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
GREEN=`echo '\033[32m'` | |
LIGHTGREEN=`echo '\033[92m'` | |
RED=`echo '\033[31m'` | |
LIGHTRED=`echo '\033[91m'` | |
CYAN=`echo '\033[36m'` | |
LIGHTCYAN=`echo '\033[96m'` | |
BLUE=`echo '\033[94m'` | |
YELLOW=`echo '\033[93m'` | |
PURPLE=`echo '\033[95m'` | |
DARKGRAY=`echo '\033[90m'` | |
BOLD=`echo '\033[1m'` | |
RESETFG=`echo '\033[39;22m'` | |
DARKGRAYBG=`echo '\033[100m'` | |
REDBG=`echo '\033[41m'` | |
RESETBG=`echo '\033[49m'` | |
RESETALL=`echo '\033[0m'` | |
RESETALLEOL=`echo '\033[K'` | |
_escape="\033\[([0-9];?)*m|\033\[K" | |
_path="(\/[[:alnum:]._-]*)+" | |
_number="[0-9]+\.?\,?\:?[0-9]*\.?\,?\:?[0-9]*\.?\,?\:?[0-9]*\.?\,?\:?[0-9]*" | |
_interactive="<[^>]*>" | |
load_failed="s/^(Failed), (modules loaded:)/$REDBG$DARKGRAY$BOLD •\1 $RESETALL$RED\$RESETALL $RED\2$RESETFG/;" | |
error="s/^($_path|$_interactive)(:$_number):( error:)/$RED$DARKGRAYBG$RESETFG$RED\✘ \1\3$RED \$RESETAL$REDBG$DARKGRAY$BOLD\•ERROR $DARKGRAY\$DARKGRAYBG$RESETALLEOL\\n/;" | |
path="s/$_path/$LIGHTCYAN&$RESETFG/;" | |
#path="s/$_path/$LIGHTCYAN HIDDENPATH$RESETFG/;" | |
exception="s/Exception:/$RED&$RESETFG/;" | |
warning="s/Warning:/$YELLOW&$RESETFG/;" | |
url="s/https?\:\/\/([A-Za-z0-9]+(\:[A-Za-z0-9]+)?@)?[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)*((\:[0-9]+)?)(\/[A-Za-z0-9;\:\/\.\-_+%~?&@=#\(\)]*)?/$LIGHTCYAN&$RESETFG/g;" | |
load_done="s/done./$GREEN&$RESETFG/g;" | |
double_colon="s/::/$RED&$RESETFG/g;" | |
definition="s/([[:alnum:]_]+)([[:space:]]*)(::)/$LIGHTCYAN\1$RESETFG\2\3/g;" | |
arrows="s/(<->|<=>|\->|<-|=>)/$RED&$RESETFG/g;" | |
monoids="s/([[:space:]()])(<\*>|<\\\$>|\\\$|<>|\.=|=<<|>>=|<<|>>|\.|\-|\=)([[:space:]()])/\1$RED\2$RESETFG\3/g;" | |
calc_operators="s/(\s)([+\-\/*])(\s)/\1$PURPLE\2$RESETFG\3/g;" | |
char="s/\'\\?.\'/$YELLOW&$RESETFG/g;" | |
number="s/([^[:alnum:]_\.])($_number)([^;[:alnum:]_\.])/\1$PURPLE\2$RESETFG\3/g;" | |
package_name="s/([[:alnum:]]+-)([[:alnum:]]+-?)*/$PURPLE\1\2$RESETFG/g;" | |
string="s/\"[^\"]*\"/$YELLOW&$RESETFG/g;" | |
parenthesis="s/[{}()]/$BLUE&$RESETFG/g;" | |
left_blacket="s/\[($_escape)/$BLUE[$RESETFG\1/g;" | |
right_blacket="s/\]/$BLUE&$RESETFG/g;" | |
no_instance="s/^\s*No instance/$RED&$RESETFG/g;" | |
interactive="s/^$_interactive/$RED&$RESETFG/g;" | |
token="s/\`[A-Za-z0-9+{}()->=@]*'/$BOLD&$RESETFG/g;" | |
comment="s/-- .*/$DARKGRAY&$RESETFG/g;" | |
identifier="s/([^/\•3]|^)([[:<:]][A-Z][A-Za-z_]*[[:>:]])(\.?)([^/])/\1$CYAN\2$RED\3$RESETFG\4/g;" | |
single_string="s/(‘)([^’]*)(’)/$DARKGRAYBG$YELLOW\1\2$YELLOW\3$RESETFG$RESETBG/g;" | |
keywords="s/([^[:alnum:]])(do|where|let)([^[:alnum:]])/\1$RED\2$RESETFG\3/g;" | |
#ghci 2>&1 | HsColour -tty | |
exec protecsed.sh "$load_failed\ | |
$error\ | |
$url\ | |
$path\ | |
$number\ | |
$package_name\ | |
$load_done\ | |
$no_instance\ | |
$exception\ | |
$interactive\ | |
$definition\ | |
$double_colon\ | |
$warning\ | |
$arrows\ | |
$identifier\ | |
$monoids\ | |
$parenthesis\ | |
$left_blacket\ | |
$right_blacket\ | |
$calc_operators\ | |
$comment\ | |
$token\ | |
$single_string\ | |
$keywords\ | |
$string\ | |
$char" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
exec "`which stack`" repl ${1+"$@"} 2>&1 | colorize.ghci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
trap '' SIGINT | |
sed -E "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment