reactive_graph_tooling/shared/info/
mod.rs

1use crate::shared::info::args::InfoArgs;
2use crate::shared::info::binary_info::BinaryInfo;
3use crate::shared::info::commands::InfoCommands;
4use crate::shared::output_format::RenderTable;
5use std::ops::Deref;
6use std::sync::LazyLock;
7
8pub mod args;
9pub mod binary_info;
10pub mod commands;
11
12pub static VERSION: &str = env!("CARGO_PKG_VERSION");
13pub static TARGET_TRIPLE: &str = env!("VERGEN_CARGO_TARGET_TRIPLE");
14pub static GIT_TAG: &str = env!("VERGEN_GIT_DESCRIBE");
15pub static GIT_COMMIT: &str = env!("VERGEN_GIT_SHA");
16pub static RUSTC_CHANNEL: &str = env!("VERGEN_RUSTC_CHANNEL");
17pub static RUSTC_VERSION: &str = env!("VERGEN_RUSTC_SEMVER");
18pub static RUSTC_HOST_TRIPLE: &str = env!("VERGEN_RUSTC_HOST_TRIPLE");
19pub static RUSTC_COMMIT_DATE: &str = env!("VERGEN_RUSTC_COMMIT_DATE");
20
21pub static BINARY_INFO: LazyLock<BinaryInfo> = LazyLock::new(|| {
22    BinaryInfo::builder()
23        .version(VERSION)
24        .target_triple(TARGET_TRIPLE)
25        .git_tag(GIT_TAG)
26        .git_commit(GIT_COMMIT)
27        .rustc_version(RUSTC_VERSION)
28        .rustc_channel(RUSTC_CHANNEL)
29        .rustc_host_triple(RUSTC_HOST_TRIPLE)
30        .rustc_commit_date(RUSTC_COMMIT_DATE)
31        .build()
32});
33
34pub fn handle_info_command(args: &InfoArgs) {
35    #[allow(clippy::match_single_binding)]
36    if let Some(commands) = &args.commands {
37        match commands {
38            InfoCommands::Info(args) => vec![BINARY_INFO.deref()].print_table_and_exit(&args.output_format),
39        }
40    }
41}