feat: Working on documentation

This commit is contained in:
2024-12-06 11:06:10 -05:00
parent 9985b55f88
commit f0873d3b44
16 changed files with 326 additions and 58 deletions

View File

@@ -0,0 +1,14 @@
import ArgumentParser
import CliDoc
@main
struct Application: ParsableCommand {
static var configuration: CommandConfiguration {
.init(
commandName: "examples",
subcommands: [
SectionCommand.self
]
)
}
}

View File

@@ -0,0 +1,30 @@
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(separator: .newLine(count: 2)) {
content.header.color(.green).bold().underline()
content.content
content.footer.italic()
}
}
}