diff --git a/lib/cli/src/cli.rs b/lib/cli/src/cli.rs index ecef4507b..9590acec4 100644 --- a/lib/cli/src/cli.rs +++ b/lib/cli/src/cli.rs @@ -478,18 +478,14 @@ fn print_packages() -> Result<(), anyhow::Error> { .collect::>(); let empty_table = rows.is_empty(); + let mut table = Table::init(rows); + table.set_titles(row!["Registry", "Package", "Version", "Commands"]); + table.set_format(*format::consts::FORMAT_NO_LINESEP_WITH_TITLE); + table.set_format(*format::consts::FORMAT_NO_COLSEP); if empty_table { - println!("--------------------------------------"); - println!("Registry Package Version Commands "); - println!("======================================"); - println!(); - } else { - let mut table = Table::init(rows); - table.set_titles(row!["Registry", "Package", "Version", "Commands"]); - table.set_format(*format::consts::FORMAT_NO_LINESEP_WITH_TITLE); - table.set_format(*format::consts::FORMAT_NO_COLSEP); - let _ = table.printstd(); - } + table.add_empty_row(); + } + let _ = table.printstd(); Ok(()) } diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index fb61bb45d..f03dd99ec 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -442,14 +442,9 @@ pub fn get_package_local_dir( "package name has to be in the format namespace/package: {name:?}" )); } - let namespace = name - .split('/') - .next() - .ok_or(format!("missing namespace for {name:?}"))?; - let name = name - .split('/') - .nth(1) - .ok_or(format!("missing name for {name:?}"))?; + let (namespace, name) = name + .split_once('/') + .ok_or(format!("missing namespace / name for {name:?}"))?; let install_dir = get_global_install_dir(registry_host).ok_or(format!("no install dir for {name:?}"))?; Ok(install_dir.join(namespace).join(name).join(version))