diff --git a/Executable/Sources/Commands/CleanCommand.swift b/Executable/Sources/Commands/CleanCommand.swift new file mode 100644 index 0000000..2b9b334 --- /dev/null +++ b/Executable/Sources/Commands/CleanCommand.swift @@ -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) + } + + } +} diff --git a/Executable/Sources/Options/CleanOptions.swift b/Executable/Sources/Options/CleanOptions.swift new file mode 100644 index 0000000..8390fcc --- /dev/null +++ b/Executable/Sources/Options/CleanOptions.swift @@ -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? + + } +}