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.
This commit is contained in:
Mattias Walström
2024-03-18 16:32:18 +01:00
parent 3519f748e5
commit d9ffff2b5a
5 changed files with 63 additions and 53 deletions
+6 -6
View File
@@ -3,37 +3,37 @@
name: "interfaces-empty"
opts:
- "json/empty.json"
- "ietf-interfaces"
- "show-interfaces"
- case: run.sh
name: "interfaces-factory"
opts:
- "json/factory.json"
- "ietf-interfaces"
- "show-interfaces"
- case: run.sh
name: "interfaces-bloated"
opts:
- "json/bloated.json"
- "ietf-interfaces"
- "show-interfaces"
- case: run.sh
name: "interface-ethernet"
opts:
- "json/bloated.json"
- "ietf-interfaces"
- "show-interfaces"
- "-n e0"
- case: run.sh
name: "interface-vlan"
opts:
- "json/bloated.json"
- "ietf-interfaces"
- "show-interfaces"
- "-n vlan1"
- case: run.sh
name: "interface-bridge"
opts:
- "json/bloated.json"
- "ietf-interfaces"
- "show-interfaces"
- "-n br0"
+3 -3
View File
@@ -3,12 +3,12 @@
SCRIPT_PATH="$(dirname "$(readlink -f "$0")")"
if [ $# -lt 2 ]; then
echo "Usage: $0 JSON-FILE MODULE [ ARGS ]"
echo "Usage: $0 JSON-FILE COMMAND [ ARGS ]"
exit 1
fi
json=$1; shift
module=$1; shift
command=$1; shift
echo "1..1"
@@ -19,7 +19,7 @@ fi
cat "$SCRIPT_PATH/$json" | \
"$SCRIPT_PATH"/../../../src/statd/cli-pretty \
"$module" $*
"$command" $*
if [ $? -eq 0 ]; then
echo "ok 1 - $json printed without crashing"
exit 0