2016-03-16 23:06:34 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2014, Juniper Networks, Inc.
|
|
|
|
# All rights reserved.
|
|
|
|
# This SOFTWARE is licensed under the LICENSE provided in the
|
|
|
|
# ../Copyright file. By downloading, installing, copying, or otherwise
|
|
|
|
# using the SOFTWARE, you agree to be bound by the terms of that
|
|
|
|
# LICENSE.
|
|
|
|
# Phil Shafer, July 2014
|
|
|
|
#
|
|
|
|
|
|
|
|
BASE=@XO_SHAREDIR@
|
2017-08-03 15:43:14 +00:00
|
|
|
VERSION=@LIBXO_VERSION@
|
2016-03-16 23:06:34 +00:00
|
|
|
CMD=cat
|
|
|
|
DONE=
|
2017-08-03 15:43:14 +00:00
|
|
|
WEB=http://juniper.github.io/libxo/${VERSION}/xohtml
|
2016-03-16 23:06:34 +00:00
|
|
|
|
|
|
|
do_help () {
|
|
|
|
echo "xohtml: wrap libxo-enabled output in HTML"
|
|
|
|
echo "Usage: xohtml [options] [command [arguments]]"
|
|
|
|
echo "Valid options are:"
|
|
|
|
echo " -b <basepath> | --base <basepath>"
|
|
|
|
echo " -c <command> | --command <command>"
|
|
|
|
echo " -f <output-file> | --file <output-file>"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
while [ -z "$DONE" -a ! -z "$1" ]; do
|
|
|
|
case "$1" in
|
|
|
|
-b|--base)
|
|
|
|
shift;
|
|
|
|
BASE="$1";
|
|
|
|
shift;
|
|
|
|
;;
|
|
|
|
-c|--command)
|
|
|
|
shift;
|
|
|
|
CMD="$1";
|
|
|
|
shift;
|
|
|
|
;;
|
|
|
|
-f|--file)
|
|
|
|
shift;
|
|
|
|
FILE="$1";
|
|
|
|
shift;
|
|
|
|
exec > "$FILE";
|
|
|
|
;;
|
2017-08-03 15:43:14 +00:00
|
|
|
-w|--web)
|
|
|
|
shift;
|
|
|
|
BASE="${WEB}";
|
|
|
|
;;
|
|
|
|
|
2016-03-16 23:06:34 +00:00
|
|
|
-*)
|
|
|
|
do_help
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
DONE=1;
|
|
|
|
XX=$1;
|
|
|
|
shift;
|
|
|
|
CMD="$XX --libxo=html $@"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ "$CMD" = "cat" -a -t 0 ]; then
|
|
|
|
do_help
|
|
|
|
fi
|
|
|
|
|
2017-06-16 06:12:07 +00:00
|
|
|
echo '<html>'
|
|
|
|
echo '<head>'
|
2016-03-16 23:06:34 +00:00
|
|
|
echo '<meta http-equiv="content-type" content="text/html; charset=utf-8"/>'
|
|
|
|
echo '<link rel="stylesheet" href="'$BASE'/xohtml.css">'
|
|
|
|
echo '<link rel="stylesheet" href="'$BASE'/external/jquery.qtip.css"/>'
|
|
|
|
echo '<script type="text/javascript" src="'$BASE'/external/jquery.js"></script>'
|
|
|
|
echo '<script type="text/javascript" src="'$BASE'/external/jquery.qtip.js"></script>'
|
|
|
|
echo '<script type="text/javascript" src="'$BASE'/xohtml.js"></script>'
|
|
|
|
echo '<script>'
|
|
|
|
echo '</script>'
|
2017-06-16 06:12:07 +00:00
|
|
|
echo '</head>'
|
|
|
|
echo '<body>'
|
2016-03-16 23:06:34 +00:00
|
|
|
|
|
|
|
$CMD
|
|
|
|
|
2017-06-16 06:12:07 +00:00
|
|
|
echo '</body>'
|
|
|
|
echo '</html>'
|
2016-03-16 23:06:34 +00:00
|
|
|
|
|
|
|
exit 0
|