When executing zig build, it immediately starts to fetch dependencies, which takes several minutes and fails eventually (which is not the topic of this post).
I would like to see the options and subcommands I have available with zig build. But already when I execute zig build --help or zig build --dry-run it immediately starts fetching dependencies again, failing after a few minutes and not giving any useful output (the help, or the commands that would be executed, respectively).
Is there a way to just get the help of zig build without actually running anything?
Not a solution to your problem, but to explain why it works like this - the help menu is populated partially by the build script. The build script determines which options and steps are available and those are reported to the user. Furthermore, the build script can depend on its dependencies during the configure phase (the part where build.zig code is being executed).
In other words, the --help menu may expose options from dependencies on it, which is why they are fetched before it is printed.
You can use zig build --fetch to obtain the dependencies when you have network access, and then from that point on zig build won’t require network access.