Implemented the UpdateCommand command in the executable target.
This commit is contained in:
parent
26a5e4232a
commit
97467f2ed8
29
Executable/Sources/Commands/UpdateCommand.swift
Normal file
29
Executable/Sources/Commands/UpdateCommand.swift
Normal file
@ -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)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
13
Executable/Sources/Options/UpdateOptions.swift
Normal file
13
Executable/Sources/Options/UpdateOptions.swift
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import ArgumentParser
|
||||||
|
import ColibriLibrary
|
||||||
|
|
||||||
|
extension Colibri.Update {
|
||||||
|
struct Options: ParsableArguments, Locationable {
|
||||||
|
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
@Option(name: .shortAndLong)
|
||||||
|
var location: String?
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user