Implemented the CleanCommand command in the executable target.

This commit is contained in:
Javier Cicchelli 2025-02-19 02:00:18 +01:00
parent 76af32225d
commit 0225ece2f9
2 changed files with 50 additions and 0 deletions

View File

@ -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)
}
}
}

View File

@ -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?
}
}