pub fn execute_async_verb<F, T>(future: F) -> Result<T>Expand description
Execute an async function and convert errors to clap_noun_verb::NounVerbError
Detects if we’re already in a tokio runtime and uses Handle::current() if so, otherwise creates a new runtime. Automatically converts anyhow errors to NounVerbError for use in verb functions.
§Examples
ⓘ
use cli::runtime_helper::execute_async_verb;
use clap_noun_verb::Result;
#[verb("doctor", "utils")]
fn utils_doctor() -> Result<DoctorOutput> {
execute_async_verb(async {
run_diagnostics().await
})
}