systemctl: describe the halt/poweroff/reboot/shutdown compat commands

The custom halt_help() and shutdown_help() are replaced by COMMAND()
descriptions (one per command name, halt/poweroff/reboot sharing the
"halt" option namespace), and --introspect-cli is added to both parsers.
halt/poweroff/reboot now each reference their own man page name.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2026-08-25 09:33:51 +02:00
parent 4cf46d47a2
commit 2364f0d7c8
3 changed files with 71 additions and 68 deletions
+10 -1
View File
@@ -18,6 +18,7 @@ INTROSPECTABLE=(
coredumpctl
dmi_memory_id
fido_id
halt
homectl
hostnamectl
importctl
@@ -30,9 +31,12 @@ INTROSPECTABLE=(
networkctl
oomctl
portablectl
poweroff
reboot
resolvectl
run0
scsi_id
shutdown
storagectl
systemctl
systemd-ac-power
@@ -138,7 +142,9 @@ for i in "${INTROSPECTABLE[@]}"; do
$i --intro | grep -e --help
# If the tool has a "help" verb, it must work too
if $i --introspect-cli | jq -e 'any(.commands[]; (.verbs // []) | any(.names[0] == "help"))' >/dev/null; then
if $i --introspect-cli | jq -e --arg name "$i" \
'any(.commands[]; any(.names[]; . == $name) and ((.verbs // []) | any(.names[0] == "help")))' \
>/dev/null; then
# 'systemctl help' shows unit manuals
[[ "$i" == systemctl ]] && continue
@@ -172,3 +178,6 @@ systemd-mstack --introspect-cli | jq -e \
systemd-run --introspect-cli | jq -e \
'[.commands[].names[0]] | sort == ["run0", "systemd-run"]'
systemctl --introspect-cli | jq -e \
'[.commands[].names[0]] | sort == ["halt", "poweroff", "reboot", "shutdown", "systemctl"]'