Files
infix/test/case/cli_pretty/run.sh
T
Mattias Walström d9ffff2b5a cli-pretty: Refactor to not take model as argument
Instead focus on the task to do 'show hardware', 'show interfaces' and more,
this to make it more logical.
2024-03-18 16:32:18 +01:00

30 lines
538 B
Bash
Executable File

#!/bin/sh
SCRIPT_PATH="$(dirname "$(readlink -f "$0")")"
if [ $# -lt 2 ]; then
echo "Usage: $0 JSON-FILE COMMAND [ ARGS ]"
exit 1
fi
json=$1; shift
command=$1; shift
echo "1..1"
if [ ! -e "$SCRIPT_PATH/$json" ]; then
echo "not ok 1 - $SCRIPT_PATH/$json not found"
exit 1
fi
cat "$SCRIPT_PATH/$json" | \
"$SCRIPT_PATH"/../../../src/statd/cli-pretty \
"$command" $*
if [ $? -eq 0 ]; then
echo "ok 1 - $json printed without crashing"
exit 0
fi
echo "not ok 1 - $json printing returned non zero"
exit 1