-
Notifications
You must be signed in to change notification settings - Fork 70
Make the nimiq-client version available via RPC and as CLI argument
#3429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: albatross
Are you sure you want to change the base?
Conversation
| 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"); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, maybe lib instead?
There was a problem hiding this comment.
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')] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd second that
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, maybe lib instead?
|
I'd also add a versioning to the |
This fixes #3390.
Retrieving the version now becomes available as:
nimiq-client --versiongetClientVersionRPC methodPull request checklist
clippyandrustfmtwarnings.