···13131414#[tokio::main]
1515async fn main() -> Result<()> {
1616- // Install color-eyre for beautiful error reports
1616+ // Color eyre for them goooood errors
1717 color_eyre::install().wrap_err("Failed to install color-eyre error handler")?;
18181919 let cli = Cli::parse();
···2626 match cli.command {
2727 None => {
2828 // No subcommand provided - load and apply configuration
2929+ // Kind of bespoke behavior but infat stands for infatuate
3030+ // I like to think it's just running the verb
2931 handle_config_load(&global_opts)
3032 .await
3133 .wrap_err("Failed to load and apply configuration")?;
···6870 }
6971 None => config::find_config_file().ok_or_else(|| {
7072 color_eyre::eyre::eyre!(
7171- "No configuration file found. Use {} or place config at XDG location",
7373+ "No configuration file found. Use {} or place config at default location",
7274 "--config".bright_yellow()
7375 )
7476 })?,
···127129 .filter(|&&x| x)
128130 .count();
129131132132+ // Some basic validation that clap can't provide
130133 if provided_count == 0 {
131134 return Err(color_eyre::eyre::eyre!(
132135 "Must provide one of: {}, {}, or {}",
···157160 println!(" Bundle ID: {}", app_info.bundle_id.bright_green());
158161 println!(" Version: {}", app_info.version);
159162 println!(" Path: {}", app_info.path.display().dimmed());
163163+164164+ // Declared means just those it claims to support
160165161166 // Display declared URL schemes
162167 if !app_info.declared_schemes.is_empty() {
-1
infat-lib/src/app.rs
···11-// infat-lib/src/app.rs
21//! Application information and management
3243use crate::{
-1
infat-lib/src/association.rs
···11-// infat-lib/src/association.rs
21//! High-level association management combining all the pieces
3243use crate::{
···11-// infat-lib/src/macos/launch_services.rs
21//! High-level Launch Services API wrappers
3243use super::ffi::*;
+4-2
infat-lib/src/macos/launch_services_db.rs
···11-// infat-lib/src/macos/launch_services_db.rs
21//! Launch Services database parsing for the init command
3243use crate::error::{InfatError, Result};
···5049 message: "Could not determine home directory".to_string(),
5150 })?;
52515252+ // Needs to be consistent across systems
5353 let ls_path = home
5454 .join("Library")
5555 .join("Preferences")
···7070 });
7171 }
72727373+ // Here we first parse into an arbitrary value and then compare against our schema
7474+7375 let plist_data = std::fs::read(&ls_path)?;
7476 let value: Value =
7577 plist::from_bytes(&plist_data).map_err(|e| InfatError::LaunchServicesError {
···115117 continue;
116118 }
117119118118- // Canonicalize the id
120120+ // Canonicalize the id (There's sometimes a difference between the id the application provides to launchservices and the one it'll key itself as to be identifed as)
119121 let canonical_id = match resolve_to_bundle_id(&bundle_id) {
120122 Ok(id) => id,
121123 Err(_) => {
+1-1
infat-lib/src/macos/workspace.rs
···11-// infat-lib/src/macos/workspace.rs
21//! NSWorkspace integration for app discovery and management
3243use crate::error::{InfatError, Result};
···76use std::path::{Path, PathBuf};
87use tracing::debug;
9899+// Make a point of linking the AppKit framework
1010#[link(name = "AppKit", kind = "framework")]
1111extern "C" {}
1212