PowerShell / DSC

This repo is for the DSC v3 project
MIT License
133 stars 22 forks source link

Update `dsc --version` to include build info #394

Open michaeltlombardi opened 2 months ago

michaeltlombardi commented 2 months ago

Summary of the new feature / enhancement

Currently, the dsc --version command is only able to emit the cargo package version of the CLI, without any other useful information. However, especially prior to the 3.0.0 release (neither alpha nor preview), people may often be building from source, and it would in general be useful to have the extended information available from clap and the build, like the branch, commit hash, rust version, etc.

For example, it could emit something like:

dsc --version

dsc 3.0.0-preview.7
branch:main
commit_hash:ef36815
build_time:2024-04-10 09:28:05 -05:00
build_env:rustc 1.76.0 (07dca489a 2024-02-04),stable-x86_64-pc-windows-msvc

We could then have users paste this output in their bug reports.

Alternatively, it would be useful to be able to record this information (and possibly other info?) with a separate command, like dsc info - both so the output could use the normal command data formatting and users could upload YAML for the reporting, and we could keep the short version information that people likely want to see without the distracting/confusing (to them) build information. We could extend an info command to include other information as needed, like the meta configuration state.

Proposed technical implementation details (optional)

I found a blog post using shadow-rs that demonstrates adding build information to a CLI built with clap in rust. I think following those steps and either extending the version command or creating a new command would be useful for bug reporting and ensuring that we're discussing the same code.