udevadm: convert to VERB_COMMAND and add --introspect-cli

The verbs declare their subcommand option namespaces, so the
introspection data describes the options of every subcommand, nested in
the verb objects.

The bare version number output (a dracut compatibility requirement) is
preserved for --version/-V and the "version" verb.

The "lock" verb's argument specification is simplified to "COMMAND" --
other verbs do not mention their options in the argspec either, and the
subcommand help states where the options may go.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2026-08-28 09:29:04 +02:00
parent 868d22628c
commit a35f5d5eba
2 changed files with 36 additions and 45 deletions
@@ -143,6 +143,7 @@ INTROSPECTABLE=(
systemd-vmspawn
systemd-vpick
timedatectl
udevadm
updatectl
userdbctl
v4l_id
@@ -208,6 +209,11 @@ fi
systemd-id128 --introspect-cli | jq -e \
'.commands[0].verbs | map(.names[0]) | contains(["new", "machine-id", "show", "help"])'
# udevadm's verbs carry their own options, reported recursively
udevadm --introspect-cli | jq -e \
'.commands[] | select(.names[0] == "udevadm") | .verbs[] | select(.names[0] == "info") |
[.options[].names[-1]] | contains(["--query", "--json", "--no-pager"])'
# systemd is optionally a multicall binary that also provides systemd-executor
if [[ "$(readlink "$(command -v systemd-executor)" 2>/dev/null)" == systemd ]]; then
systemd --introspect-cli | jq -e \