Implemented the Clean subcommand (#8)

This PR contains the work done to implement the `Update` subcommand that clean the  *Hummingbird* project.

Reviewed-on: #8
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 #8.
This commit is contained in:
2025-02-19 01:02:32 +00:00
committed by Javier Cicchelli
parent ab5f589547
commit ced12d509e
5 changed files with 228 additions and 0 deletions
+1
View File
@@ -9,6 +9,7 @@ struct Colibri: AsyncParsableCommand {
abstract: "The utility to manage your Hummingbird apps",
subcommands: [
Build.self,
Clean.self,
Create.self,
Outdated.self,
Update.self
@@ -0,0 +1,31 @@
import ArgumentParser
import ColibriLibrary
extension Colibri {
struct Clean: AsyncParsableCommand {
// MARK: Properties
static let configuration = CommandConfiguration(
commandName: "clean-project",
abstract: "Clean a Hummingbird app",
helpNames: .shortAndLong,
aliases: ["clean"]
)
@OptionGroup var options: Options
// MARK: Functions
mutating func run() async throws {
let terminalService = TerminalService()
let cleanProject = CleanProjectTask(terminalService: terminalService)
try await cleanProject(at: options.locationURL,
shouldReset: options.reset,
purgeCache: options.purgeCache)
}
}
}
@@ -0,0 +1,19 @@
import ArgumentParser
import ColibriLibrary
extension Colibri.Clean {
struct Options: ParsableArguments, Locationable {
// MARK: Properties
@Flag(name: .shortAndLong)
var reset: Bool = false
@Flag(name: .shortAndLong)
var purgeCache: Bool = false
@Option(name: .shortAndLong)
var location: String?
}
}