Generate shell-completions and man pages in build.rs
Although build.rs cannot import modules from xh, it is possible to use the include!() to paste the content of src/cli.rs into build.rs.
See https://kbknapp.dev/shell-completions/
I considered doing it at build time, but I didn't like it.
build.rs generating files that are checked into source control is seemingly discouraged. cargo will refuse to upload if a build script changes the contents of src. You're supposed to put them in $OUT_DIR, which isn't ergonomic.
The man pages are generated with help2man, and I don't think we can expect everyone to have that installed.
OTOH ripgrep has build.rs generate completions and build a man page (with asciidoctor): https://github.com/BurntSushi/ripgrep/blob/3ca324fda75885bf3523762ed57811d80abb3b00/FAQ.md#does-ripgrep-have-a-man-page
It only generates the man page if it can find the tools. I didn't think of that.
But it has to do some work to find the files it generates: https://github.com/BurntSushi/ripgrep/blob/20534fad0404417487318dcc7d6fb5a91835a278/ci/cargo-out-dir
Not sure if this is a good idea, but it's worth another look.