added configuration.md
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package de.hoennig.gittally.commands
|
||||
|
||||
import de.hoennig.gittally.config.ConfigLoader
|
||||
import org.springframework.stereotype.Component
|
||||
import picocli.CommandLine.Command
|
||||
import picocli.CommandLine.Option
|
||||
@@ -10,11 +11,22 @@ import picocli.CommandLine.Option
|
||||
description = ["Print the effective configuration"],
|
||||
mixinStandardHelpOptions = true,
|
||||
)
|
||||
class ConfigPrintCommand : Runnable {
|
||||
class ConfigPrintCommand(
|
||||
private val configLoader: ConfigLoader,
|
||||
) : Runnable {
|
||||
@Option(names = ["--full"], description = ["Include all defaults"])
|
||||
var full: Boolean = false
|
||||
|
||||
override fun run() {
|
||||
println("config:print${if (full) " --full" else ""} – not yet implemented")
|
||||
if (full) {
|
||||
print(configLoader.toYaml(configLoader.load()))
|
||||
} else {
|
||||
val raw = configLoader.loadRaw()
|
||||
if (raw.isEmpty()) {
|
||||
println("(no configuration files found)")
|
||||
} else {
|
||||
print(configLoader.toYaml(raw))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user