prax_cli/commands/
version.rs1use crate::error::CliResult;
4use crate::output::{self, kv};
5
6const VERSION: &str = env!("CARGO_PKG_VERSION");
8
9const NAME: &str = env!("CARGO_PKG_NAME");
11
12pub async fn run() -> CliResult<()> {
14 output::logo();
15 output::newline();
16
17 kv("Version", VERSION);
18 kv("Binary", NAME);
19
20 #[cfg(debug_assertions)]
22 let build_mode = "debug";
23 #[cfg(not(debug_assertions))]
24 let build_mode = "release";
25
26 kv("Build", build_mode);
27
28 let mut features = Vec::new();
30
31 #[cfg(feature = "postgres")]
32 features.push("postgres");
33
34 #[cfg(feature = "mysql")]
35 features.push("mysql");
36
37 #[cfg(feature = "sqlite")]
38 features.push("sqlite");
39
40 if features.is_empty() {
41 features.push("none");
42 }
43
44 kv("Features", &features.join(", "));
45
46 output::newline();
47
48 output::section("Components");
50 kv("prax-schema", env!("CARGO_PKG_VERSION"));
51 kv("prax-query", env!("CARGO_PKG_VERSION"));
52 kv("prax-codegen", env!("CARGO_PKG_VERSION"));
53 kv("prax-migrate", env!("CARGO_PKG_VERSION"));
54
55 output::newline();
56 output::dim("https://prax.dev");
57
58 Ok(())
59}