Skip nested channel namespaces in orbit search
A repo such as example/greet under main is another channel's package, and its name is not a valid package name, so search no longer lists it under main. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8eadda5815
commit
984494f556
1 file changed
+9
-1
+9
-1
@@ -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 ")
|
||||
|
||||
Reference in new issue
Block a user