42 lines
793 B
Swift
42 lines
793 B
Swift
public struct ShellCommand: NodeRepresentable {
|
|
|
|
@usableFromInline
|
|
let symbol: any NodeRepresentable
|
|
|
|
@usableFromInline
|
|
let command: any NodeRepresentable
|
|
|
|
@inlinable
|
|
public init(
|
|
@NodeBuilder symbol: () -> any NodeRepresentable,
|
|
@NodeBuilder command: () -> any NodeRepresentable
|
|
) {
|
|
self.symbol = symbol()
|
|
self.command = command()
|
|
}
|
|
|
|
@inlinable
|
|
public init(
|
|
symbol: String = " $",
|
|
@NodeBuilder command: () -> any NodeRepresentable
|
|
) {
|
|
self.init { symbol } command: { command() }
|
|
}
|
|
|
|
@inlinable
|
|
public init(
|
|
symbol: String = " $",
|
|
command: String
|
|
) {
|
|
self.init { symbol } command: { command }
|
|
}
|
|
|
|
@inlinable
|
|
public func render() -> String {
|
|
Group(separator: " ") {
|
|
symbol
|
|
command
|
|
}.render()
|
|
}
|
|
}
|