mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-30 20:43:02 +02:00
Instead focus on the task to do 'show hardware', 'show interfaces' and more, this to make it more logical.
30 lines
538 B
Bash
Executable File
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
|