mirror of
https://github.com/GayPizzaSpecifications/darwin-apk.git
synced 2025-08-03 21:41:31 +00:00
Consolidate update+reader & remove some dead code
This commit is contained in:
@ -31,8 +31,8 @@ public struct ApkRepositoriesConfig {
|
||||
}
|
||||
}
|
||||
|
||||
public extension ApkIndex {
|
||||
@inlinable static func resolve(_ config: ApkRepositoriesConfig, fetch: ApkIndexFetchMode) async throws -> Self {
|
||||
public extension ApkIndexReader {
|
||||
@inlinable static func resolve(_ config: ApkRepositoriesConfig, fetch: FetchMode) async throws -> ApkIndex {
|
||||
try await Self.resolve(config.repositories, fetch: fetch)
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ struct DpkSearchCommand: AsyncParsableCommand {
|
||||
let localRepositories = try await ApkRepositoriesConfig()
|
||||
let index: ApkIndex
|
||||
do {
|
||||
index = try await ApkIndex.resolve(localRepositories, fetch: .local)
|
||||
index = try await ApkIndexReader.resolve(localRepositories, fetch: .local)
|
||||
} catch {
|
||||
eprint("Failed to build package index: \(error.localizedDescription)")
|
||||
throw .failure
|
||||
|
@ -19,7 +19,7 @@ struct DpkUpdateCommand: AsyncParsableCommand {
|
||||
func run() async throws {
|
||||
let repositories = try await ApkRepositoriesConfig().repositories
|
||||
eprint("Updating package repositories")
|
||||
let index = try await ApkIndex.resolve(repositories, fetch: self.lazyDownload ? .lazy : .update)
|
||||
let index = try await ApkIndexReader.resolve(repositories, fetch: self.lazyDownload ? .lazy : .update)
|
||||
eprint("Indexed \(index.packages.count) package(s)")
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user