Implemented the Update subcommand (#7)

This PR contains the work done to implement the `Update` subcommand that update the package dependencies in a *Hummingbird* project.

Reviewed-on: #7
Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
This commit was merged in pull request #7.
This commit is contained in:
2025-02-19 00:14:00 +00:00
committed by Javier Cicchelli
parent 7ee071010d
commit ab5f589547
6 changed files with 67 additions and 17 deletions
+2 -1
View File
@@ -10,7 +10,8 @@ struct Colibri: AsyncParsableCommand {
subcommands: [
Build.self,
Create.self,
Outdated.self
Outdated.self,
Update.self
],
defaultSubcommand: Create.self
)
@@ -20,9 +20,9 @@ extension Colibri {
mutating func run() async throws {
let terminalService = TerminalService()
let outdatedDependencies = OutdatedDependenciesTask(terminalService: terminalService)
let updateDependencies = UpdateDependenciesTask(terminalService: terminalService)
try await outdatedDependencies(at: options.locationURL)
try await updateDependencies(at: options.locationURL, checkOutdated: true)
}
}
@@ -0,0 +1,29 @@
import ArgumentParser
import ColibriLibrary
extension Colibri {
struct Update: AsyncParsableCommand {
// MARK: Properties
static let configuration = CommandConfiguration(
commandName: "update-dependencies",
abstract: "Update package dependencies in a Hummingbird app",
helpNames: .shortAndLong,
aliases: ["update"]
)
@OptionGroup var options: Options
// MARK: Functions
mutating func run() async throws {
let terminalService = TerminalService()
let updateDependencies = UpdateDependenciesTask(terminalService: terminalService)
try await updateDependencies(at: options.locationURL)
}
}
}
@@ -0,0 +1,13 @@
import ArgumentParser
import ColibriLibrary
extension Colibri.Update {
struct Options: ParsableArguments, Locationable {
// MARK: Properties
@Option(name: .shortAndLong)
var location: String?
}
}