mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 16:28:12 -07:00
Merge pull request #280 from ethauvin/master
Fix for --log -2 undocumented "quiet" feature.
This commit is contained in:
commit
c6072710fe
3 changed files with 17 additions and 10 deletions
|
@ -42,8 +42,9 @@ class Args {
|
||||||
@Parameter(names = arrayOf("--listTemplates"), description = "List the available templates")
|
@Parameter(names = arrayOf("--listTemplates"), description = "List the available templates")
|
||||||
var listTemplates: Boolean = false
|
var listTemplates: Boolean = false
|
||||||
|
|
||||||
@Parameter(names = arrayOf("--log"), description = "Define the log level (1-3)")
|
@Parameter(names = arrayOf("--log"), description = "Define the log level " +
|
||||||
var log: Int = 1
|
"(${Constants.LOG_DEFAULT_LEVEL}-${Constants.LOG_MAX_LEVEL})")
|
||||||
|
var log: Int = Constants.LOG_DEFAULT_LEVEL
|
||||||
|
|
||||||
@Parameter(names = arrayOf("--forceIncremental"),
|
@Parameter(names = arrayOf("--forceIncremental"),
|
||||||
description = "Force the build to be incremental even if the build file was modified")
|
description = "Force the build to be incremental even if the build file was modified")
|
||||||
|
|
|
@ -3,6 +3,8 @@ package com.beust.kobalt
|
||||||
import com.beust.kobalt.misc.KFiles
|
import com.beust.kobalt.misc.KFiles
|
||||||
|
|
||||||
object Constants {
|
object Constants {
|
||||||
|
const val LOG_DEFAULT_LEVEL = 1
|
||||||
|
const val LOG_MAX_LEVEL = 3
|
||||||
val BUILD_FILE_NAME = "Build.kt"
|
val BUILD_FILE_NAME = "Build.kt"
|
||||||
val BUILD_FILE_DIRECTORY = "kobalt/src"
|
val BUILD_FILE_DIRECTORY = "kobalt/src"
|
||||||
val BUILD_FILE_PATH = KFiles.joinDir(BUILD_FILE_DIRECTORY, BUILD_FILE_NAME)
|
val BUILD_FILE_PATH = KFiles.joinDir(BUILD_FILE_DIRECTORY, BUILD_FILE_NAME)
|
||||||
|
|
|
@ -33,7 +33,11 @@ private fun parseArgs(argv: Array<String>): Main.RunInfo {
|
||||||
val args = Args()
|
val args = Args()
|
||||||
val result = JCommander(args)
|
val result = JCommander(args)
|
||||||
result.parse(*argv)
|
result.parse(*argv)
|
||||||
KobaltLogger.LOG_LEVEL = args.log
|
KobaltLogger.LOG_LEVEL = if (args.log < 0) {
|
||||||
|
Constants.LOG_DEFAULT_LEVEL
|
||||||
|
} else if (args.log > Constants.LOG_MAX_LEVEL) {
|
||||||
|
Constants.LOG_MAX_LEVEL
|
||||||
|
} else args.log
|
||||||
return Main.RunInfo(result, args)
|
return Main.RunInfo(result, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue