diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 3b4df59..4fb5bd8 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -59,3 +59,4 @@ dirs.workspace = true anstream = "0.6.15" owo-colors = "4.0.0" +const_format = "0.2.33" diff --git a/cli/src/main.rs b/cli/src/main.rs index be5ae6a..ceeabb9 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -9,6 +9,7 @@ use std::{ }; use clap::{Parser, Subcommand, ValueEnum}; +use const_format::formatcp; use futures::stream::{self, StreamExt}; use indicatif::{MultiProgress, ProgressBar, ProgressStyle}; use owo_colors::OwoColorize; @@ -29,7 +30,12 @@ use tracing::level_filters::LevelFilter; use tracing_subscriber::{fmt::MakeWriter, EnvFilter}; #[derive(Parser)] -#[clap(author, version, about, long_about = None)] +#[clap( + author, + version = formatcp!("{}\nrustypipe {}", env!("CARGO_PKG_VERSION"), rustypipe::VERSION), + about, + long_about = None +)] struct Cli { #[clap(subcommand)] command: Commands, diff --git a/src/lib.rs b/src/lib.rs index 89837ae..012211e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,3 +19,6 @@ pub mod model; pub mod param; pub mod report; pub mod validate; + +/// Version of the RustyPipe crate +pub const VERSION: &str = env!("CARGO_PKG_VERSION"); diff --git a/src/report.rs b/src/report.rs index e0df4ff..a0a793c 100644 --- a/src/report.rs +++ b/src/report.rs @@ -108,7 +108,7 @@ impl RustyPipeInfo<'_> { pub(crate) fn new(language: Option) -> Self { Self { package: env!("CARGO_PKG_NAME"), - version: env!("CARGO_PKG_VERSION"), + version: crate::VERSION, date: util::now_sec(), language, }