Skip to content

Instantly share code, notes, and snippets.

@washtubs
Created February 27, 2015 12:37
Show Gist options
  • Select an option

  • Save washtubs/a6cea1bec984fcdb4915 to your computer and use it in GitHub Desktop.

Select an option

Save washtubs/a6cea1bec984fcdb4915 to your computer and use it in GitHub Desktop.
#!/usr/bin/env zsh
if ! ( which ansi2html &>/dev/null ); then
echo You need to install ansi2html. This is just a convenient wrapper!
echo sudo cpan HTML::FromANSI
exit 1
fi
local space=""
local cmd=""
for arg in $@; do
cmd="${cmd}${space}${arg}"
space=" "
done
local tmp=$(mktemp 2htmlXXXX)
#-i interactive mode loads your zshrc, and includes aliases
script -qc "$SHELL -ic \"${cmd}\"" > $tmp
ansi2html -f $tmp > $HOME/.2html.html
sed -i -e 's/black/white/g' $HOME/.2html.html
google-chrome-stable $HOME/.2html.html
#xdg-open $HOME/.2html.html
rm $tmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment