This is an another alternative for #40656, based on @poettering's suggestion to use an ELF section. The output of --help is generated using format-table, but the details of the formatting a bit off: different sections in the table (verbs, option groups) are not aligned to the same column. Our current table formatting doesn't make this easy. If somebody has an idea how to do this without too much pain, please make suggestions. Another thing that I didn't know how to do nicely, was to use the two columns of separation. But maybe this doesn't matter. If we switch to one column everywhere, I don't think people will care. Example output: ```console $ build/systemd-id128 -h | cat systemd-id128 [OPTIONS...] COMMAND Generate and print 128-bit identifiers. Commands: new Generate a new ID machine-id Print the ID of current machine boot-id Print the ID of current boot invocation-id Print the ID of current invocation var-partition-uuid Print the UUID for the /var/ partition show [NAME|UUID] Print one or more UUIDs help Show this help Options: -h --help Show this help --version Show package version --no-pager Do not start a pager --no-legend Do not show headers and footers --json=FORMAT Output inspection data in JSON (takes one of pretty, short, off) -j Equivalent to --json=pretty (on TTY) or --json=short (otherwise) -p --pretty Generate samples of program code -P --value Only print the value -a --app-specific=ID Generate app-specific IDs -u --uuid Output in UUID format See the systemd-id128(1) man page for details. ``` The output wraps automatically with terminal width. If the terminal is extremely narrow, ellipsization occurs. I think this doesn't matter and/or is actually a feature. Such narrow terminals mostly occur in testing, so it doesn't matter what exactly we do, as long as it is something somewhat reasonable. Anyway, I think this is enough as PoC. Please compare this with the previous approach. /cc @behrmann, @YHNdnzj, @poettering The three binaries that are converted have options, verbs, optional arguments, and options terminate option parsing, so most of the functionality is there. One thing that I didn't implement that was present in previous PRs is "namespaces", i.e. multiple parsers in the same source file. I expect that we can handle this similarly to option groups.
System and Service Manager
Details
Most documentation is available on systemd's web site.
Assorted, older, general information about systemd can be found in the systemd Wiki.
Information about build requirements is provided in the README file.
Consult our NEWS file for information about what's new in the most recent systemd versions.
Please see the Code Map for information about this repository's layout and content.
Please see the Hacking guide for information on how to hack on systemd and test your modifications.
Please see our Contribution Guidelines for more information about filing GitHub Issues and posting GitHub Pull Requests.
When preparing patches for systemd, please follow our Coding Style Guidelines.
If you are looking for support, please contact our mailing list, join our IRC channel #systemd on libera.chat or Matrix channel
Stable branches with backported patches are available in the stable repo.
We have a security bug bounty program sponsored by the Sovereign Tech Fund hosted on YesWeHack
Repositories with distribution packages built from git main are available on OBS, and also repositories with packages built from the latest stable release
