Implemented the CleanCommand command in the executable target.
This commit is contained in:
parent
76af32225d
commit
0225ece2f9
31
Executable/Sources/Commands/CleanCommand.swift
Normal file
31
Executable/Sources/Commands/CleanCommand.swift
Normal 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)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
19
Executable/Sources/Options/CleanOptions.swift
Normal file
19
Executable/Sources/Options/CleanOptions.swift
Normal 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?
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user