diff --git a/Executable/Sources/Commands/OpenCommand.swift b/Executable/Sources/Commands/OpenCommand.swift new file mode 100644 index 0000000..688659c --- /dev/null +++ b/Executable/Sources/Commands/OpenCommand.swift @@ -0,0 +1,29 @@ +import ArgumentParser +import ColibriLibrary + +extension Colibri { + struct Open: AsyncParsableCommand { + + // MARK: Properties + + static let configuration = CommandConfiguration( + commandName: "open-project", + abstract: "Open a Hummingbird app", + helpNames: .shortAndLong, + aliases: ["open"] + ) + + @OptionGroup var options: Options + + // MARK: Functions + + mutating func run() async throws { + let terminalService = TerminalService() + + let openProject = OpenProjectTask(terminalService: terminalService) + + try await openProject(with: options.ide, at: options.locationURL) + } + + } +} diff --git a/Executable/Sources/Extensions/IDE+Conformances.swift b/Executable/Sources/Extensions/IDE+Conformances.swift new file mode 100644 index 0000000..413ea49 --- /dev/null +++ b/Executable/Sources/Extensions/IDE+Conformances.swift @@ -0,0 +1,6 @@ +import ArgumentParser +import ColibriLibrary + +// MARK: - ExpressibleByArgument + +extension IDE: ExpressibleByArgument {} diff --git a/Executable/Sources/Options/OpenOptions.swift b/Executable/Sources/Options/OpenOptions.swift new file mode 100644 index 0000000..4f94ec7 --- /dev/null +++ b/Executable/Sources/Options/OpenOptions.swift @@ -0,0 +1,16 @@ +import ArgumentParser +import ColibriLibrary + +extension Colibri.Open { + struct Options: ParsableArguments, Locationable { + + // MARK: Properties + + @Option(name: .shortAndLong) + var ide: IDE = .xcode + + @Option(name: .shortAndLong) + var location: String? + + } +}