1
0
mirror of https://github.com/jht5945/rust_util.git synced 2025-12-27 15:40:03 +08:00

feat: update dependency version, add clap run_with

This commit is contained in:
2021-01-24 22:31:11 +08:00
parent 50159a0ca8
commit cb1b8187fa
2 changed files with 10 additions and 6 deletions

View File

@@ -59,9 +59,13 @@ impl CommandExecutor {
}
pub fn run(&self) -> XResult<()> {
let mut app = App::new(env!("CARGO_PKG_NAME"))
let app = App::new(env!("CARGO_PKG_NAME"))
.version(env!("CARGO_PKG_VERSION"))
.about(env!("CARGO_PKG_DESCRIPTION"));
self.run_with(app)
}
pub fn run_with<'a>(&self, mut app: App<'a, 'a>) -> XResult<()> {
if let Some(default_cmd) = &self.default_cmd {
app = default_cmd.process_command(app);
}