From 97467f2ed879f686584d11308fb679278e1d4fd4 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Wed, 19 Feb 2025 01:09:12 +0100 Subject: [PATCH] Implemented the UpdateCommand command in the executable target. --- .../Sources/Commands/UpdateCommand.swift | 29 +++++++++++++++++++ .../Sources/Options/UpdateOptions.swift | 13 +++++++++ 2 files changed, 42 insertions(+) create mode 100644 Executable/Sources/Commands/UpdateCommand.swift create mode 100644 Executable/Sources/Options/UpdateOptions.swift diff --git a/Executable/Sources/Commands/UpdateCommand.swift b/Executable/Sources/Commands/UpdateCommand.swift new file mode 100644 index 0000000..eaf869a --- /dev/null +++ b/Executable/Sources/Commands/UpdateCommand.swift @@ -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) + } + + } +} diff --git a/Executable/Sources/Options/UpdateOptions.swift b/Executable/Sources/Options/UpdateOptions.swift new file mode 100644 index 0000000..8dcb812 --- /dev/null +++ b/Executable/Sources/Options/UpdateOptions.swift @@ -0,0 +1,13 @@ +import ArgumentParser +import ColibriLibrary + +extension Colibri.Update { + struct Options: ParsableArguments, Locationable { + + // MARK: Properties + + @Option(name: .shortAndLong) + var location: String? + + } +}