diff --git a/src/main/ops.mbt b/src/main/ops.mbt index e8db354..f51baa0 100644 --- a/src/main/ops.mbt +++ b/src/main/ops.mbt @@ -801,7 +801,9 @@ async fn cmd_search(ctx : Ctx, term : String) -> Unit raise OrbitError { listed = listed + 1 let candidates : Array[String] = [] for r in lines(out) { - if contains_str(r, term) { + // A name with "/" is a nested channel namespace (e.g. example/greet under + // main), not a package name that `orbit install` could use. + if valid_name(r) && contains_str(r, term) { candidates.push(r) } } @@ -879,6 +881,12 @@ test "search info comes from OCI annotations" { assert_eq(bare.description, "") } +///| +test "search skips nested channel namespaces" { + assert_true(valid_name("greet")) + assert_true(!valid_name("example/greet")) +} + ///| test "table columns line up" { assert_eq(pad_right("ab", 4), "ab ")