feat: Working on documentation
This commit is contained in:
14
Examples/Sources/CliDoc-Examples/CliDoc_Examples.swift
Normal file
14
Examples/Sources/CliDoc-Examples/CliDoc_Examples.swift
Normal file
@@ -0,0 +1,14 @@
|
||||
import ArgumentParser
|
||||
import CliDoc
|
||||
|
||||
@main
|
||||
struct Application: ParsableCommand {
|
||||
static var configuration: CommandConfiguration {
|
||||
.init(
|
||||
commandName: "examples",
|
||||
subcommands: [
|
||||
SectionCommand.self
|
||||
]
|
||||
)
|
||||
}
|
||||
}
|
||||
30
Examples/Sources/CliDoc-Examples/SectionCommand.swift
Normal file
30
Examples/Sources/CliDoc-Examples/SectionCommand.swift
Normal 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()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user