feat: add RustyPipe version constant

This commit is contained in:
ThetaDev 2024-09-10 03:15:41 +02:00
parent a7fb0d641a
commit c5e695e297
4 changed files with 12 additions and 2 deletions

View file

@ -59,3 +59,4 @@ dirs.workspace = true
anstream = "0.6.15" anstream = "0.6.15"
owo-colors = "4.0.0" owo-colors = "4.0.0"
const_format = "0.2.33"

View file

@ -9,6 +9,7 @@ use std::{
}; };
use clap::{Parser, Subcommand, ValueEnum}; use clap::{Parser, Subcommand, ValueEnum};
use const_format::formatcp;
use futures::stream::{self, StreamExt}; use futures::stream::{self, StreamExt};
use indicatif::{MultiProgress, ProgressBar, ProgressStyle}; use indicatif::{MultiProgress, ProgressBar, ProgressStyle};
use owo_colors::OwoColorize; use owo_colors::OwoColorize;
@ -29,7 +30,12 @@ use tracing::level_filters::LevelFilter;
use tracing_subscriber::{fmt::MakeWriter, EnvFilter}; use tracing_subscriber::{fmt::MakeWriter, EnvFilter};
#[derive(Parser)] #[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 { struct Cli {
#[clap(subcommand)] #[clap(subcommand)]
command: Commands, command: Commands,

View file

@ -19,3 +19,6 @@ pub mod model;
pub mod param; pub mod param;
pub mod report; pub mod report;
pub mod validate; pub mod validate;
/// Version of the RustyPipe crate
pub const VERSION: &str = env!("CARGO_PKG_VERSION");

View file

@ -108,7 +108,7 @@ impl RustyPipeInfo<'_> {
pub(crate) fn new(language: Option<Language>) -> Self { pub(crate) fn new(language: Option<Language>) -> Self {
Self { Self {
package: env!("CARGO_PKG_NAME"), package: env!("CARGO_PKG_NAME"),
version: env!("CARGO_PKG_VERSION"), version: crate::VERSION,
date: util::now_sec(), date: util::now_sec(),
language, language,
} }