#!/bin/sh
set -e

echo "Testing rtl_wmbus (help output)"
# rtl_wmbus without arguments prints help when stdin is a terminal
# Use script to provide a pseudo-terminal, or use -z for invalid option
OUTPUT=$(rtl_wmbus -z 2>&1 || true)

if echo "$OUTPUT" | grep -q "Usage"; then
    echo "PASS: Help output contains usage information"
else
    echo "FAIL: Help output does not contain usage information"
    exit 1
fi

# Check that help mentions key options
for opt in "-o" "-a" "-d" "-s" "-v" "-V" "-h"; do
    if echo "$OUTPUT" | grep -q -- "$opt"; then
        echo "PASS: Help mentions option $opt"
    else
        echo "FAIL: Help does not mention option $opt"
        exit 1
    fi
done
