Index: Cargo.toml ================================================================== --- Cargo.toml +++ Cargo.toml @@ -1,8 +1,8 @@ [package] name = "qsu" -version = "0.7.0" +version = "0.7.1" edition = "2021" license = "0BSD" # https://crates.io/category_slugs categories = [ "os" ] keywords = [ "service", "systemd", "winsvc" ] @@ -36,22 +36,22 @@ wait-for-debugger = ["dep:dbgtools-win"] [dependencies] async-trait = { version = "0.1.83" } chrono = { version = "0.4.38" } -clap = { version = "4.5.20", optional = true, features = [ +clap = { version = "4.5.21", optional = true, features = [ "derive", "env", "string", "wrap_help" ] } env_logger = { version = "0.11.5" } futures = { version = "0.3.31" } itertools = { version = "0.13.0", optional = true } killswitch = { version = "0.4.2" } log = { version = "0.4.22" } parking_lot = { version = "0.12.3" } rocket = { version = "0.5.1", optional = true } -sidoc = { version = "0.1.0", optional = true } -tokio = { version = "1.40.0", features = ["sync"] } +sidoc = { version = "0.1.1", optional = true } +tokio = { version = "1.41.1", features = ["sync"] } time = { version = "0.3.36", features = ["macros"] } tracing = { version = "0.1.40" } [dependencies.tracing-subscriber] version = "0.3.18" @@ -60,27 +60,27 @@ [target.'cfg(target_os = "linux")'.dependencies] sd-notify = { version = "0.4.3", optional = true } [target.'cfg(unix)'.dependencies] -libc = { version = "0.2.160" } +libc = { version = "0.2.164" } nix = { version = "0.29.0", features = ["pthread", "signal", "time"] } [target.'cfg(windows)'.dependencies] dbgtools-win = { version = "0.2.1", optional = true } -eventlog = { version = "0.2.2" } -registry = { version = "1.2.3" } +eventlog = { version = "0.3.0" } +registry = { version = "1.3.0" } scopeguard = { version = "1.2.0" } windows-service = { version = "0.7.0" } windows-sys = { version = "0.59.0", features = [ "Win32_Foundation", "Win32_System_Console" ] } winreg = { version = "0.52.0" } [dev-dependencies] -clap = { version = "4.5.20", features = ["derive", "env", "wrap_help"] } -tokio = { version = "1.40.0", features = ["time"] } +clap = { version = "4.5.21", features = ["derive", "env", "wrap_help"] } +tokio = { version = "1.41.1", features = ["time"] } [package.metadata.docs.rs] all-features = true rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"] Index: examples/argp/mod.rs ================================================================== --- examples/argp/mod.rs +++ examples/argp/mod.rs @@ -1,17 +1,33 @@ -use clap::ArgMatches; +use clap::{ArgMatches, Command}; -use qsu::{installer::RegSvc, rt::SrvAppRt}; +use qsu::{argp::Cmd, installer::RegSvc, rt::SrvAppRt}; use crate::err::Error; pub struct AppArgsProc { pub(crate) bldr: Box SrvAppRt> } impl qsu::argp::ArgsProc for AppArgsProc { type AppErr = Error; + + fn conf_cmd( + &mut self, + cmdtype: Cmd, + cmd: Command + ) -> Result { + let cmd = if cmdtype == Cmd::Root { + // tip: help_template() can be used to include version number in help + cmd + .name(env!("CARGO_BIN_NAME")) + .version(env!("CARGO_PKG_VERSION")) + } else { + cmd + }; + Ok(cmd) + } /// Process an `register-service` subcommand. fn proc_inst( &mut self, _sub_m: &ArgMatches, Index: src/argp.rs ================================================================== --- src/argp.rs +++ src/argp.rs @@ -251,10 +251,11 @@ } /// Used to differentiate between running without a subcommand, or the /// install/uninstall or run service subcommands. +#[derive(Debug, PartialEq, Eq)] pub enum Cmd { /// The root `Command`. Root, /// The service registration/installation `Command`. Index: www/changelog.md ================================================================== --- www/changelog.md +++ www/changelog.md @@ -5,10 +5,12 @@ ## [Unreleased] [Details](/vdiff?from=qsu-0.7.0&to=trunk) ### Added + +- Derive `Debug`, `PartialEq` and `Eq` for `argp::Cmd`. ### Changed ### Removed