cascade_cli/cli/commands/
version.rs

1use crate::cli::output::Output;
2use crate::errors::Result;
3
4/// Show version information
5pub async fn run() -> Result<()> {
6    Output::section("Cascade CLI");
7    Output::sub_item(format!("Version: {}", env!("CARGO_PKG_VERSION")));
8    Output::sub_item(format!("Authors: {}", env!("CARGO_PKG_AUTHORS")));
9    Output::sub_item(format!("Homepage: {}", env!("CARGO_PKG_HOMEPAGE")));
10    Output::sub_item(format!("Description: {}", env!("CARGO_PKG_DESCRIPTION")));
11
12    Output::section("Build Information");
13    Output::sub_item(format!("Rust version: {}", env!("CARGO_PKG_RUST_VERSION")));
14    Output::sub_item(format!("Target: {}", std::env::consts::ARCH));
15    Output::sub_item(format!("OS: {}", std::env::consts::OS));
16
17    #[cfg(debug_assertions)]
18    Output::sub_item("Build type: Debug");
19    #[cfg(not(debug_assertions))]
20    Output::sub_item("Build type: Release");
21
22    Output::section("Key Dependencies");
23    Output::sub_item("clap: 4.0+");
24    Output::sub_item("git2: 0.18+");
25    Output::sub_item("reqwest: 0.11+");
26    Output::sub_item("tokio: 1.0+");
27    Output::sub_item("serde: 1.0+");
28
29    Output::section("Links");
30    Output::sub_item("Repository: https://github.com/your-org/cascade-cli");
31    Output::sub_item("Issues: https://github.com/your-org/cascade-cli/issues");
32    Output::sub_item("Documentation: https://github.com/your-org/cascade-cli/wiki");
33
34    Output::section("Quick Start");
35    Output::sub_item("Initialize repository: ca init");
36    Output::sub_item("Show help: ca --help");
37    Output::sub_item("Check status: ca status");
38
39    Ok(())
40}
41
42#[cfg(test)]
43mod tests {
44    use super::*;
45
46    #[tokio::test]
47    async fn test_version_command() {
48        let result = run().await;
49        assert!(result.is_ok());
50    }
51}