Add pre-check function

This commit is contained in:
ByteDream 2022-12-03 00:39:52 +01:00
parent 9d45995e86
commit 135d59ce8b
3 changed files with 24 additions and 18 deletions

View file

@ -16,6 +16,7 @@ pub use cli::{archive::Archive, download::Download, login::Login};
#[async_trait::async_trait(?Send)]
trait Execute {
fn pre_check(&self) -> Result<()> { Ok(()) }
async fn execute(self, ctx: Context) -> Result<()>;
}
@ -163,7 +164,7 @@ pub async fn cli_entrypoint() {
}
};
if let Err(err) = result {
error!("{}", err);
error!("a unexpected error occurred: {}", err);
std::process::exit(1)
}
}