Add version flags and bump toes-matter to 0.1.15

This commit is contained in:
Pat Nakajima 2026-05-20 19:01:57 +00:00
parent 574236eff6
commit 0a19e56497
4 changed files with 15 additions and 2 deletions

2
Cargo.lock generated
View File

@ -2589,7 +2589,7 @@ checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca"
[[package]] [[package]]
name = "toes-matter" name = "toes-matter"
version = "0.1.14" version = "0.1.15"
dependencies = [ dependencies = [
"async-compat", "async-compat",
"embassy-time-queue-utils", "embassy-time-queue-utils",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "toes-matter" name = "toes-matter"
version = "0.1.14" version = "0.1.15"
edition = "2021" edition = "2021"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
readme = "README.md" readme = "README.md"

View File

@ -110,6 +110,10 @@ impl Options {
while let Some(arg) = args.next() { while let Some(arg) = args.next() {
match arg.as_str() { match arg.as_str() {
"-V" | "--version" => {
println!("toes-matter-credentials {}", env!("CARGO_PKG_VERSION"));
std::process::exit(0);
}
"-h" | "--help" => { "-h" | "--help" => {
print_usage(); print_usage();
std::process::exit(0); std::process::exit(0);
@ -191,6 +195,7 @@ fn print_usage() {
--password PASS Serial login password [env: SERIAL_PASSWORD]\n\ --password PASS Serial login password [env: SERIAL_PASSWORD]\n\
--prompt PROMPT Shell prompt marker; may repeat [env: SERIAL_PROMPT]\n\ --prompt PROMPT Shell prompt marker; may repeat [env: SERIAL_PROMPT]\n\
--login-timeout-secs N Serial login timeout [default: 30, env: SERIAL_LOGIN_TIMEOUT_SECS]\n\ --login-timeout-secs N Serial login timeout [default: 30, env: SERIAL_LOGIN_TIMEOUT_SECS]\n\
-V, --version Show version\n\
-h, --help Show this help" -h, --help Show this help"
); );
} }

View File

@ -3,6 +3,14 @@
use core::pin::pin; use core::pin::pin;
fn main() -> toes_matter::Result<()> { fn main() -> toes_matter::Result<()> {
if std::env::args()
.skip(1)
.any(|arg| matches!(arg.as_str(), "-V" | "--version"))
{
println!("toes-matter {}", env!("CARGO_PKG_VERSION"));
return Ok(());
}
env_logger::init_from_env( env_logger::init_from_env(
env_logger::Env::default().filter_or(env_logger::DEFAULT_FILTER_ENV, "info"), env_logger::Env::default().filter_or(env_logger::DEFAULT_FILTER_ENV, "info"),
); );