feat: Updates cli documentation for utils commands.

This commit is contained in:
2024-12-09 11:43:31 -05:00
parent 357914ba93
commit a8d35fed37
3 changed files with 24 additions and 17 deletions

View File

@@ -1,14 +1,14 @@
import ArgumentParser
struct CreateProjectTemplateCommand: AsyncParsableCommand {
struct GenerateProjectTemplateCommand: AsyncParsableCommand {
static let commandName = "create-template"
static let commandName = "generate-template"
static let configuration = CommandConfiguration.playbook(
commandName: commandName,
abstract: "Create a home performance assesment project template.",
abstract: "Generate a home performance assesment project template.",
parentCommand: UtilsCommand.commandName,
examples: (label: "Create Template", example: "\(commandName) /path/to/project-template")
examples: (label: "Generate Template", example: "\(commandName) /path/to/project-template")
)
@OptionGroup var globals: GlobalOptions

View File

@@ -1,5 +1,6 @@
import ArgumentParser
import CliClient
import CliDoc
import Dependencies
struct GenerateConfigurationCommand: AsyncParsableCommand {
@@ -9,18 +10,23 @@ struct GenerateConfigurationCommand: AsyncParsableCommand {
static let configuration = CommandConfiguration(
commandName: commandName,
abstract: createAbstract("Generate a local configuration file."),
discussion: """
\("NOTE:".yellow) If a directory is not supplied then a configuration file will be created
at \("'~/.config/hpa-playbook/config'".yellow).
\("Example:".yellow)
\("Create a directory and generate the configuration file.".green)
$ mkdir -p ~/.config/hpa-playbook
$ hpa generate-config --path ~/.config/hpa-playbook
discussion: Discussion {
VStack {
Note {
"""
If a directory is not supplied then a configuration file will be created
at \("'~/.config/hpa-playbook/config'".yellow).
"""
}
VStack {
"EXAMPLE:".yellow.bold
"Create a directory and generate the configuration".green
ShellCommand("mkdir -p ~/.config/hpa-playbook")
ShellCommand("hpa generate-config --path ~/.config/hpa-playbook")
}
}
.separator(.newLine(count: 2))
}
)
@Option(

View File

@@ -5,12 +5,13 @@ struct UtilsCommand: AsyncParsableCommand {
static let configuration = CommandConfiguration(
commandName: commandName,
abstract: "\("Utility commands.".blue)",
abstract: createAbstract("Utility commands."),
discussion: """
These are commands that are generally only run on occasion / less frequently used.
""",
subcommands: [
CreateProjectTemplateCommand.self, GenerateConfigurationCommand.self
GenerateProjectTemplateCommand.self,
GenerateConfigurationCommand.self
]
)