Show info for packages that aren't installed
- `orbit info` finds a package that isn't installed, or a `channel::` / `@constraint` build, in the cached channel listings used by search - Channel indexes record each version's manifest digest, so a repeated info needs no network - Versions without a digest, or indexes built before digests were added, are resolved in the registry - Show the docs link, channel, digest, bins and dependencies for available builds
This commit is contained in:
1 parent
022898ed65
commit
a00c87bf04
7 files changed
+176
-29
No files matched your search
@@ -61,6 +61,36 @@ fn package_details(
|
||||
]
|
||||
}
|
||||
|
||||
///|
|
||||
/// The details of a build in a channel that isn't installed: it has no paths
|
||||
/// yet, so bins are shown as they sit in the package.
|
||||
fn available_details(
|
||||
m : Manifest,
|
||||
channel~ : String,
|
||||
digest~ : String,
|
||||
) -> Array[Detail] {
|
||||
let bins = m.bins.copy()
|
||||
if bins.is_empty() {
|
||||
bins.push("(none)")
|
||||
}
|
||||
let specs = fn(reqs : Map[String, String]) {
|
||||
let out : Array[String] = []
|
||||
for n, c in reqs {
|
||||
out.push(n + "@" + c)
|
||||
}
|
||||
join(out, " ")
|
||||
}
|
||||
[
|
||||
("description", [m.description]),
|
||||
("docs", [m.documentation]),
|
||||
("channel", [channel]),
|
||||
("digest", [digest]),
|
||||
("bin", bins),
|
||||
("depends", [specs(m.depends)]),
|
||||
("conflicts", [specs(m.conflicts)]),
|
||||
]
|
||||
}
|
||||
|
||||
///|
|
||||
fn installed_details(ctx : Ctx, p : Installed) -> Array[Detail] {
|
||||
package_details(
|
||||
@@ -116,3 +146,17 @@ test "package details show paths and every bin" {
|
||||
"bin: (none)",
|
||||
])
|
||||
}
|
||||
|
||||
///|
|
||||
test "available details show bins as packaged and the docs link" {
|
||||
let m = parse_manifest(
|
||||
"{\"name\":\"t\",\"version\":\"1.0.0\",\"description\":\"A tool\",\"documentation\":\"https://x/t\",\"bin\":[\"bin/a\"],\"depends\":{\"x\":\"^1\"}}",
|
||||
)
|
||||
assert_eq(
|
||||
detail_lines(available_details(m, channel="main", digest="sha256:ab"), ""),
|
||||
[
|
||||
"description: A tool", "docs: https://x/t", "channel: main", "digest: sha256:ab",
|
||||
"bin: bin/a", "depends: x@^1",
|
||||
],
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user