Skip to main content

stellar_scaffold_cli/commands/
version.rs

1use clap::Parser;
2use std::fmt::Debug;
3
4#[derive(Parser, Debug, Clone)]
5#[group(skip)]
6pub struct Cmd;
7
8impl Cmd {
9    #[allow(clippy::unused_self)]
10    pub fn run(&self) {
11        println!("scaffold {}", long());
12    }
13}
14
15pub fn pkg() -> &'static str {
16    env!("CARGO_PKG_VERSION")
17}
18
19pub fn git() -> &'static str {
20    env!("GIT_REVISION")
21}
22
23pub fn long() -> String {
24    let xdr = stellar_xdr::VERSION;
25
26    [
27        format!("{} ({})", pkg(), git()),
28        format!(
29            "stellar {} ({})",
30            stellar_cli::commands::version::pkg(),
31            stellar_cli::commands::version::git()
32        ),
33        format!(
34            "stellar-xdr {} ({})
35xdr curr ({})",
36            xdr.pkg, xdr.rev, xdr.xdr_curr,
37        ),
38    ]
39    .join("\n")
40}