Skip to main content

rbnx/cmd/
version.rs

1// SPDX-License-Identifier: MulanPSL-2.0
2// `rbnx version [--json]` — the build facts behind `rbnx --version`, in a
3// form a script can read.
4
5use anyhow::Result;
6use robonix_cli::{Config, SourcePathKey, build_info::BuildInfo};
7
8pub fn execute(config: &Config, json: bool) -> Result<()> {
9    let info = BuildInfo::get();
10    if !json {
11        println!("rbnx {}", info.summary());
12        return Ok(());
13    }
14    let mut report = serde_json::to_value(&info)?;
15    report["source_root"] = serde_json::json!(config.resolve_source_path(SourcePathKey::Root).ok());
16    println!("{report}");
17    Ok(())
18}
浙ICP备2023005800号-2 浙公网安备33010902005384号