Implemented the OpenCommand subcommand in the executable target.
This commit is contained in:
parent
0b2bcd6d1e
commit
77363a7c0e
29
Executable/Sources/Commands/OpenCommand.swift
Normal file
29
Executable/Sources/Commands/OpenCommand.swift
Normal file
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
6
Executable/Sources/Extensions/IDE+Conformances.swift
Normal file
6
Executable/Sources/Extensions/IDE+Conformances.swift
Normal file
@ -0,0 +1,6 @@
|
||||
import ArgumentParser
|
||||
import ColibriLibrary
|
||||
|
||||
// MARK: - ExpressibleByArgument
|
||||
|
||||
extension IDE: ExpressibleByArgument {}
|
16
Executable/Sources/Options/OpenOptions.swift
Normal file
16
Executable/Sources/Options/OpenOptions.swift
Normal file
@ -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?
|
||||
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user