Skip to content

Commit

Permalink
ansi2html.sh: support OSX
Browse files Browse the repository at this point in the history
Lookup GNU sed which we depend on
  • Loading branch information
brendano authored and pixelb committed Oct 16, 2013
1 parent 85a65ed commit bd2aabd
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions scripts/ansi2html.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
# Handle codes with combined attributes and color.
# Handle isolated <bold> attributes with css.
# Strip more terminal control codes.
# V0.14, 16 May 2013
# V0.15, 16 Oct 2013
# http://github.com/pixelb/scripts/commits/master/scripts/ansi2html.sh

if [ "$1" = "--version" ]; then
printf '0.14\n' && exit
printf '0.15\n' && exit
fi

if [ "$1" = "--help" ]; then
Expand Down Expand Up @@ -87,6 +87,17 @@ fi

[ "$1" = "--bg=dark" ] && { dark_bg=yes; shift; }

# Mac OSX's GNU sed is installed as gsed
# use e.g. homebrew 'gnu-sed' to get it
if ! sed --version >/dev/null 2>&1; then
if gsed --version >/dev/null 2>&1; then
alias sed=gsed
else
echo "Error, can't find an acceptable GNU sed." >&2
exit 1
fi
fi

printf '%s' "<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>
Expand Down

0 comments on commit bd2aabd

Please sign in to comment.