1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use clap::{Arg, ArgAction::SetTrue, ArgMatches};
const CLI_VERSION: &str = env!("CARGO_PKG_VERSION");
use crate::config::Config;
pub fn cli() -> clap::Command {
clap::Command::new("version")
.about("Print the version of the command line tool.")
.after_help("Run `spacetime help version for more detailed information.\n`")
.arg(
Arg::new("cli")
.short('c')
.long("cli")
.action(SetTrue)
.help("Prints only the CLI version"),
)
}
pub async fn exec(_config: Config, args: &ArgMatches) -> Result<(), anyhow::Error> {
if args.get_flag("cli") {
println!("{}", CLI_VERSION);
return Ok(());
}
println!(
"spacetimedb tool version {}; spacetimedb-lib version {};",
CLI_VERSION,
spacetimedb_lib::version::spacetimedb_lib_version()
);
Ok(())
}