feat: Adds stack separators, removes some unused nodes from cli-doc module
All checks were successful
CI / Run tests. (push) Successful in 52s

This commit is contained in:
2024-12-08 10:58:03 -05:00
parent c977a1c805
commit c6a269f062
12 changed files with 229 additions and 177 deletions

View File

@@ -39,11 +39,11 @@ public enum Separator {
public var body: some TextNode {
switch self {
case let .tab(count: count):
seperator("\t", count: count)
makeSeperator("\t", count: count)
case let .space(count: count):
seperator(" ", count: count)
makeSeperator(" ", count: count)
case let .custom(string, count: count):
seperator(string, count: count)
makeSeperator(string, count: count)
}
}
}
@@ -85,15 +85,17 @@ public enum Separator {
public var body: some TextNode {
switch self {
case let .newLine(count: count):
seperator("\n", count: count)
makeSeperator("\n", count: count)
case let .custom(string, count: count):
seperator(string, count: count)
makeSeperator(string, count: count)
}
}
}
}
// MARK: - Private Helpers.
@usableFromInline
func ensuredCount(_ count: Int) -> Int {
guard count >= 1 else { return 1 }
@@ -101,7 +103,7 @@ func ensuredCount(_ count: Int) -> Int {
}
@usableFromInline
func seperator(_ separator: String, count: Int) -> some TextNode {
func makeSeperator(_ separator: String, count: Int) -> some TextNode {
let count = ensuredCount(count)
assert(count >= 1, "Invalid count while creating a separator")