How to include version information from dune-project

So this might actually be doable. Since dune knows the version, and there is a library ppxlib with a function ppx_get_env which can read an environment variable and expand the macro into a string at compile time. If there’s a way to set the environment variable from dune’s end (maybe a rule, I’m not super familiar with dune yet) and then use ppxlib to get that environment variable, it avoids needing the extra file and I can get the version from the dune-project as a singular source of truth for the version. There’s also an example repo with a deriver, which would be cool to then use on cmdliner’s Cmd.Info to auto-derive the version. This is probably as close to the rust/cargo/clap way of doing it as I imagine I will get. In rust you can just do:

use clap::{Command, Parser};

#[derive(Debug, Clone, Parser)]
#[command(version)]
struct MyCommand;

And this will just get the version from the Cargo.toml

[package]
version = "0.1.0"
...

I think there’s a few things it can automatically get from the Cargo.toml, so maybe once I get the version portion working I will also include other derivers.