#!/bin/bash
#
# Copyright (c) 2017 CNRS
# Authors: Joseph Mirabel
#
#
# This file is part of hpp-tools
# hpp-tools is free software: you can redistribute it
# and/or modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation, either version
# 3 of the License, or (at your option) any later version.
#
# hpp-tools is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Lesser Public License for more details.  You should have
# received a copy of the GNU Lesser General Public License along with
# hpp-tools  If not, see
# <http://www.gnu.org/licenses/>.

if [ $# -gt 0 ]; then
  name=$1
else
  echo "Add filename as argument"
  exit 1
fi

cat $name | \
  sed --unbuffered -E "s/([A-Z]+):(\/[^\/]+)+\/([kh]pp[-/][a-z-]+)\/[^:]+:([0-9]+:)?/\1:\3:/" \
  | highlight --config-file="/var/folders/k8/j7r3p6cx43xdqhzy2rmp6tqr0000gn/T/cmeel-ox6_6yp4/whl/cmeel.prefix/etc/hpp-tools/highlight/log.lang" --style=darkness --out-format=xterm256 --syntax=log
