From b24ff24426c1b6f830669a7f6f90411bf11762b9 Mon Sep 17 00:00:00 2001 From: Antonio Yang Date: Tue, 20 Apr 2021 18:35:01 +0800 Subject: [PATCH] handle completions subcommand first (#116) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * handle completions subcommand first * raise errors from comp_matches Co-authored-by: Clément DOUIN Co-authored-by: Clément DOUIN --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 8de4fec..c7d4a97 100644 --- a/src/main.rs +++ b/src/main.rs @@ -67,6 +67,10 @@ fn run() -> Result<()> { debug!("[main] log level: {}", log_level); debug!("[main] custom config path: {:?}", custom_config); + if comp_matches(build_app(), &matches)? { + return Ok(()); + } + debug!("[main] init config"); let config = Config::new(custom_config)?; trace!("[main] {:#?}", config); @@ -83,7 +87,6 @@ fn run() -> Result<()> { let _matched = mbox_matches(&account, &matches)? || flag_matches(&account, &mbox, &matches)? || imap_matches(&config, &account, &mbox, &matches)? - || comp_matches(build_app(), &matches)? || msg_matches(&config, &account, &mbox, &matches)?; Ok(())