()
| 256 | |
| 257 | #[tokio::main] |
| 258 | async fn main() -> Result<()> { |
| 259 | // Zig might try to execute the same program again with "ar" as the name |
| 260 | // to link specific static native libraries. We need to check |
| 261 | // the program name before executing any operation to ensure |
| 262 | // that the static linking works correctly. |
| 263 | let mut args = env::args(); |
| 264 | let program_path = PathBuf::from(args.next().expect("missing program path")); |
| 265 | let program_name = program_path.file_stem().expect("missing program name"); |
| 266 | |
| 267 | if program_name.eq_ignore_ascii_case("ar") { |
| 268 | let zig = Zig::Ar { |
| 269 | args: args.collect(), |
| 270 | }; |
| 271 | run_zig(zig) |
| 272 | } else { |
| 273 | let app = App::parse(); |
| 274 | |
| 275 | match app { |
| 276 | App::Zig(zig) => run_zig(zig), |
| 277 | App::Lambda(lambda) => { |
| 278 | let color = Color::from_str(&lambda.color) |
| 279 | .expect("invalid color option, must be auto, always, or never"); |
| 280 | color.write_env_var(); |
| 281 | miette::set_hook(error_hook(Some(&color)))?; |
| 282 | |
| 283 | run_subcommand(lambda, color).await |
| 284 | } |
| 285 | } |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | async fn run_subcommand(lambda: Lambda, color: Color) -> Result<()> { |
| 290 | if lambda.version { |
nothing calls this directly
no test coverage detected