feat: Adds generate-config as json file.

This commit is contained in:
2024-11-29 22:25:50 -05:00
parent 505f7d8013
commit ed3f752694
6 changed files with 97 additions and 36 deletions

View File

@@ -11,8 +11,14 @@ struct GenerateConfigurationCommand: AsyncParsableCommand {
abstract: "\("Generate a local configuration file.".blue)",
discussion: """
If a directory is not supplied then a configuration file will be created
at \("'~/.config/hpa-playbook/config'".yellow).
\("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
"""
)
@@ -24,6 +30,12 @@ struct GenerateConfigurationCommand: AsyncParsableCommand {
)
var path: String?
@Flag(
name: .shortAndLong,
help: "Generate a json file, instead of default env style"
)
var json: Bool = false
@OptionGroup var globals: BasicGlobalOptions
mutating func run() async throws {
@@ -48,7 +60,7 @@ struct GenerateConfigurationCommand: AsyncParsableCommand {
actualPath = "\(path)/config"
}
try cliClient.createConfiguration(actualPath)
try cliClient.createConfiguration(actualPath, json)
}
}
}