Connect applications to schemes, filetypes, and more on macOS (more to come)
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Removed the rest of the depedency on async code from main

+8 -20
+8 -20
infat-cli/src/main.rs
··· 15 15 16 16 use cli::{Cli, Commands}; 17 17 18 - #[tokio::main] 19 - async fn main() -> Result<()> { 18 + fn main() -> Result<()> { 20 19 // Color eyre for them goooood errors 21 20 color_eyre::install().wrap_err("Failed to install color-eyre error handler")?; 22 21 ··· 32 31 // No subcommand provided - load and apply configuration 33 32 // Kind of bespoke behavior but infat stands for infatuate 34 33 // I like to think it's just running the verb 35 - handle_config_load(&global_opts) 36 - .await 37 - .wrap_err("Failed to load and apply configuration")?; 34 + handle_config_load(&global_opts).wrap_err("Failed to load and apply configuration")?; 38 35 } 39 36 Some(Commands::Info { 40 37 app, ··· 42 39 scheme, 43 40 r#type, 44 41 }) => { 45 - handle_info_command(app, ext, scheme, r#type) 46 - .await 47 - .wrap_err("Info command failed")?; 42 + handle_info_command(app, ext, scheme, r#type).wrap_err("Info command failed")?; 48 43 } 49 44 Some(Commands::Set { 50 45 app_name, ··· 53 48 r#type, 54 49 }) => { 55 50 handle_set_command(&global_opts, app_name, ext, scheme, r#type) 56 - .await 57 51 .wrap_err("Set command failed")?; 58 52 } 59 53 Some(Commands::Init { output }) => { 60 - handle_init_command(&global_opts, output) 61 - .await 62 - .wrap_err("Init command failed")?; 54 + handle_init_command(&global_opts, output).wrap_err("Init command failed")?; 63 55 } 64 56 } 65 57 66 58 Ok(()) 67 59 } 68 60 69 - async fn handle_config_load(opts: &GlobalOptions) -> Result<()> { 61 + fn handle_config_load(opts: &GlobalOptions) -> Result<()> { 70 62 let config_path = match &opts.config_path { 71 63 Some(path) => { 72 64 if !path.exists() { ··· 118 110 119 111 // Apply configuration 120 112 config::apply_config(&config, opts.robust) 121 - .await 122 113 .wrap_err("Failed to apply configuration settings")?; 123 114 124 115 if !opts.quiet { ··· 131 122 Ok(()) 132 123 } 133 124 134 - async fn handle_info_command( 125 + fn handle_info_command( 135 126 app: Option<String>, 136 127 ext: Option<String>, 137 128 scheme: Option<String>, ··· 316 307 Ok(()) 317 308 } 318 309 319 - async fn handle_set_command( 310 + fn handle_set_command( 320 311 opts: &GlobalOptions, 321 312 app_name: String, 322 313 ext: Option<String>, ··· 350 341 info!("Setting {} as default for .{}", app_name, extension); 351 342 352 343 association::set_default_app_for_extension(&extension, &app_name) 353 - .await 354 344 .wrap_err_with(|| format!("Failed to set default app for .{extension}"))?; 355 345 356 346 if !opts.quiet { ··· 365 355 info!("Setting {} as default for {} scheme", app_name, url_scheme); 366 356 367 357 association::set_default_app_for_url_scheme(&url_scheme, &app_name) 368 - .await 369 358 .wrap_err_with(|| format!("Failed to set default app for {url_scheme} scheme"))?; 370 359 371 360 if !opts.quiet { ··· 380 369 info!("Setting {} as default for type {}", app_name, type_name); 381 370 382 371 association::set_default_app_for_type(&type_name, &app_name) 383 - .await 384 372 .wrap_err_with(|| format!("Failed to set default app for type {type_name}"))?; 385 373 386 374 if !opts.quiet { ··· 396 384 Ok(()) 397 385 } 398 386 399 - async fn handle_init_command(opts: &GlobalOptions, output: Option<PathBuf>) -> Result<()> { 387 + fn handle_init_command(opts: &GlobalOptions, output: Option<PathBuf>) -> Result<()> { 400 388 info!("Initializing configuration from Launch Services database"); 401 389 402 390 if !opts.quiet {