Skip to content

Conversation

@Eligioo
Copy link
Member

@Eligioo Eligioo commented Jul 8, 2025

This fixes #3390.

Retrieving the version now becomes available as:

  • nimiq-client --version
  • getClientVersion RPC method

Pull request checklist

  • All tests pass. The project builds and runs.
  • I have resolved any merge conflicts.
  • I have resolved all clippy and rustfmt warnings.

@Eligioo Eligioo requested a review from jsdanielh July 8, 2025 09:06
pub use self::{sensitive::Sensitive, waker::WakerExt};

/// The version of the client based on the Cargo workspace package
pub const CLIENT_VERSION: &str = env!("CARGO_PKG_VERSION");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit weird to put this into utils, currently nimiq-utils doesn't have any concept of a client.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, maybe lib instead?

Copy link
Member Author

@Eligioo Eligioo Jul 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially created the const in lib too but didn't want to introduce a new crate dependency for rpc-server just for this constant. So other suggestions are welcome or else lib works for me.

pub prove: bool,

/// Output the version of the client and exit immediately afterwards.
#[clap(long, short = 'v')]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd remove the short option, -v is usually used for verbose logging.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd second that

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, it depends on what you are used to I guess. gcc, node and docker from the top of my head use -v for the client version. But agree that being more explicit here doesn't hurt.


// Simply log the Cargo package version a.k.a version of the client and return early
if command_line.version {
log::info!("Client version {}", CLIENT_VERSION);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
log::info!("Client version {}", CLIENT_VERSION);
log::info!("nimiq-client {}", CLIENT_VERSION);

I checked a couple of --version flags on my machine and most have the output <PROGRAM> <VERSION>.

pub use self::{sensitive::Sensitive, waker::WakerExt};

/// The version of the client based on the Cargo workspace package
pub const CLIENT_VERSION: &str = env!("CARGO_PKG_VERSION");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, maybe lib instead?

@jsdanielh
Copy link
Member

I'd also add a versioning to the rpc-client and potentially any other binary we have

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Get nimiq-client version via CLI and RPC

4 participants