handle completions subcommand first (#116)

* handle completions subcommand first

* raise errors from comp_matches

Co-authored-by: Clément DOUIN <soywod@users.noreply.github.com>

Co-authored-by: Clément DOUIN <soywod@users.noreply.github.com>
This commit is contained in:
Antonio Yang 2021-04-20 18:35:01 +08:00 committed by GitHub
parent 6284b0c5a6
commit b24ff24426
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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(())