Implemented the Clean subcommand #8

Merged
javier merged 3 commits from command/clean-project into main 2025-02-19 01:02:33 +00:00
2 changed files with 50 additions and 0 deletions
Showing only changes of commit 0225ece2f9 - Show all commits

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