#!/bin/sh
if [ -t 0 ] ; then
    CLIQUE_COLUMNS=$(stty size 2>/dev/null | cut -d ' ' -f 2)
    export CLIQUE_COLUMNS
fi

# extend relx default timeout (60s) if it has not already been overwritten
if [ $RELX_RPC_TIMEOUT -eq 60 ] ; then
    export RELX_RPC_TIMEOUT=300
fi

j=1
l=$#
buf="[[\"config\","
while [ $j -le $l ]; do
    buf="$buf\"$1\","
    j=$(( j + 1 ))
    shift
done

buf="${buf%?}]]"

relx_nodetool rpc hpr_console command "$buf"
exit $?
