From 5df135fda9b8373110d2fd877cb5fd0437fd1459 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Sun, 3 Jan 2021 01:30:10 +0800 Subject: [PATCH] feat: use XResult<()> --- src/util_clap.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util_clap.rs b/src/util_clap.rs index ff048e9..eb41bcb 100644 --- a/src/util_clap.rs +++ b/src/util_clap.rs @@ -48,7 +48,7 @@ impl CommandExecutor { self } - pub fn run(&self) -> CommandError { + pub fn run(&self) -> XResult<()> { let mut app = App::new(env!("CARGO_PKG_NAME")) .version(env!("CARGO_PKG_VERSION")) .about(env!("CARGO_PKG_DESCRIPTION")); @@ -62,7 +62,7 @@ impl CommandExecutor { for command in &self.commands { if let Some(sub_cmd_matches) = matches.subcommand_matches(command.name()) { match command.run(&matches, sub_cmd_matches)? { - None => return Ok(None), + None => return Ok(()), Some(code) => process::exit(code), } } @@ -73,7 +73,7 @@ impl CommandExecutor { process::exit(1); }, Some(default_cmd) => match default_cmd.run(&matches)? { - None => return Ok(None), + None => return Ok(()), Some(code) => process::exit(code), }, }