Files
swift-cli-doc/Examples/Sources/CliDoc-Examples/SectionCommand.swift
Michael Housh 78a632c3e5
All checks were successful
CI / Run tests. (push) Successful in 52s
feat: Adds more documentation and examples.
2024-12-08 18:27:31 -05:00

32 lines
673 B
Swift

import ArgumentParser
import CliDocCore
struct SectionCommand: ParsableCommand {
static var configuration: CommandConfiguration {
.init(commandName: "section")
}
func run() throws {
let section = Section {
"My super awesome section"
} header: {
"Awesome"
} footer: {
"Note: this is super awesome"
}
print(section.style(MySectionStyle()).render())
}
}
struct MySectionStyle: SectionStyle {
func render(content: SectionConfiguration) -> some TextNode {
VStack {
content.header.color(.green).bold().underline()
content.content
content.footer.italic()
}
.separator(.newLine(count: 2))
}
}