feat: Working on node builder

This commit is contained in:
2024-12-01 15:25:42 -05:00
parent ff49b12198
commit 96a1fac07b
11 changed files with 357 additions and 21 deletions

View File

@@ -1,4 +1,5 @@
import ArgumentParser
import CliDoc
import Rainbow
extension CommandConfiguration {
@@ -29,6 +30,25 @@ extension CommandConfiguration {
)
}
static func playbook2(
commandName: String,
abstract: String,
parentCommand: String? = nil,
examples: (label: String, example: String)...
) -> Self {
.init(
commandName: commandName,
abstract: Abstract { abstract.blue },
usage: """
\(Constants.appName)\(parentCommand != nil ? " \(parentCommand!)" : "") \(commandName)
""".blue.bold.italic
+ " [OPTIONS]".green
+ " [ARGUMENTS]".cyan
+ " --" + " [EXTRA-OPTIONS...]".magenta,
discussion: CliDoc.Discussion.playbook(examples: examples)
)
}
static func playbook(
commandName: String,
abstract: String,
@@ -52,6 +72,7 @@ func createAbstract(_ string: String) -> String {
"\(string.blue)"
}
// TODO: Remove
struct Discussion {
let nodes: [Node]