diff --git a/bin/core/imag-ref/src/main.rs b/bin/core/imag-ref/src/main.rs index b117aae8..585c69f4 100644 --- a/bin/core/imag-ref/src/main.rs +++ b/bin/core/imag-ref/src/main.rs @@ -69,24 +69,22 @@ fn main() { &version, "Reference files outside of the store", build_ui); - rt.cli() - .subcommand_name() - .map(|name| { - debug!("Call: {}", name); - match name { - "deref" => deref(&rt), - "create" => create(&rt), - "remove" => remove(&rt), - "list-dead" => list_dead(&rt), - other => { - debug!("Unknown command"); - let _ = rt.handle_unknown_subcommand("imag-ref", other, rt.cli()) - .map_err_trace_exit_unwrap() - .code() - .map(::std::process::exit); - }, - }; - }); + if let Some(name) = rt.cli().subcommand_name() { + debug!("Call: {}", name); + match name { + "deref" => deref(&rt), + "create" => create(&rt), + "remove" => remove(&rt), + "list-dead" => list_dead(&rt), + other => { + debug!("Unknown command"); + let _ = rt.handle_unknown_subcommand("imag-ref", other, rt.cli()) + .map_err_trace_exit_unwrap() + .code() + .map(::std::process::exit); + }, + }; + } } fn deref(rt: &Runtime) {