MCPcopy Create free account
hub / github.com/cargo-lambda/cargo-lambda / main

Function main

crates/cargo-lambda-cli/src/main.rs:258–287  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

256
257#[tokio::main]
258async 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
289async fn run_subcommand(lambda: Lambda, color: Color) -> Result<()> {
290 if lambda.version {

Callers

nothing calls this directly

Calls 4

run_zigFunction · 0.85
error_hookFunction · 0.85
run_subcommandFunction · 0.85
write_env_varMethod · 0.80

Tested by

no test coverage detected