Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,38 @@ use squitterator::{
};

use clap::Parser;
use log::error;
use std::sync::Arc;

fn main() -> AppResult<()> {
let args = Arc::new(Args::parse());

// Initialize error logging if specified
if let Some(error_log_file) = &args.error_log {
initialize_logger(error_log_file)?;
};
}

// Set observer coordinates if provided
if let Some(coord_str) = &args.observer_coord {
set_observer_coords_from_str(coord_str)
};
set_observer_coords_from_str(coord_str);
}

let planes = Planes::new();

let reader_thread = spawn_reader_thread(args, planes);

// Wait for the reader thread to complete
reader_thread
.join()
.expect("Couldn't join on the associated thread")?;
.map_err(|_| {
std::io::Error::new(
std::io::ErrorKind::Other,
"Failed to join reader thread: thread panicked",
)
})?
.map_err(|e| {
error!("Reader thread error: {}", e);
e
})?;

Ok(())
}
Loading