Skip to content

Instantly share code, notes, and snippets.

@anekos
Created June 8, 2014 05:56
Show Gist options
  • Save anekos/0c8986e748218f535631 to your computer and use it in GitHub Desktop.
Save anekos/0c8986e748218f535631 to your computer and use it in GitHub Desktop.
refe-color: Ruby の refe コマンドの出力に色つけたりする
#!/bin/bash
VAL_m='1'
VAL_header='1;4'
VAL_at='1;34'
VAL_quote='44'
sed_pattern=`printf '
s/\[\[m:/\[%sm/g ;
s/\]\]/\[0m/g ;
s/^\* \(.*\)$/\[%sm\\\\1/g ;
s/^@\([^ ]*\)/\[%sm\\\\1/g ;
s/^\--- \(.*\)$/ \[%sm\\\\1/g ;
' "$VAL_m" "$VAL_header" "$VAL_at" "$VAL_quote"`
function filter {
sed "$sed_pattern"
}
refe "$@" | filter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment