Skip to content

Commit 0a71970

Browse files
committed
add version command
1 parent 2b43e44 commit 0a71970

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

Cargo.lock

Lines changed: 1 addition & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/litehouse/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "litehouse"
3-
version = "0.3.0"
3+
version = "0.3.1"
44
description = "A lightweight home automation server"
55
edition.workspace = true
66
license.workspace = true

crates/litehouse/src/main.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@ mod util;
1818

1919
/// CLI options for litehouse
2020
#[derive(clap::Parser)]
21+
#[command(arg_required_else_help(true))]
2122
struct Opt {
2223
#[command(subcommand)]
23-
command: Subcommand,
24+
command: Option<Subcommand>,
25+
/// Print the current version of litehouse and exit
26+
#[clap(long)]
27+
version: bool,
2428
}
2529

2630
#[cfg(feature = "dhat-heap")]
@@ -61,5 +65,14 @@ async fn main_inner() -> Result<()> {
6165

6266
let opt = Opt::parse();
6367

64-
opt.command.run().await
68+
if opt.version {
69+
println!("{}", env!("CARGO_PKG_VERSION"));
70+
return Ok(());
71+
}
72+
73+
if let Some(command) = opt.command {
74+
return command.run().await;
75+
}
76+
77+
Ok(())
6578
}

0 commit comments

Comments
 (0)