#!/bin/bash
if [ "$1" == 'debug'  ]; then set -x;   shift; fi
if [ "$1" == 'debug2' ]; then set -xvT; shift; fi
####################################################
# - Runtime -
# Get Watcher's runtime environment
# @@@@@@@@@@@@@@@ Experimental @@@@@@@@@@@@@@@@@@@@
####################################################
#------------------------
REALPATH=`realpath $0`
WHERE=`dirname $REALPATH`
ME=`basename $REALPATH`
cd $WHERE
. ../system.conf
. ../watcher.conf
. ../common.conf
. ../common.bashlib
#------------------------
RUNTIME=$MASTER_PATH/RUNTIME

OUTFORM='%-15s: %s\n'
TOTFORM='%15s » %s\n'

declare -A Runtime
Runtime[Path]=$PATH
Runtime[systemversion]=$SYSVERS
Runtime[system]=$SYSTEM
Runtime[systemstyle]=$SYSSTYLE
Runtime[systemlike]=$SYSLIKE
Runtime[masterpath]=$MASTER_PATH
Runtime[toolpath]=$TOOLS_LINK
Runtime[pool]=$POOL
Runtime[awkpath]=$AWKPATH
Runtime[bashlib]=$BASHLIB

> $RUNTIME
for elem in ${!Runtime[@]}
do printf "$OUTFORM" $elem "${Runtime[$elem]}"
done
