mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-17 11:24:56 -04:00
fix printing of help arguments
This commit is contained in:
parent
3a413352d9
commit
5879f10856
@ -13,14 +13,17 @@
|
||||
|
||||
package de.bixilon.minosoft.terminal
|
||||
|
||||
import de.bixilon.kutil.shutdown.AbstractShutdownReason
|
||||
import de.bixilon.kutil.shutdown.ShutdownManager
|
||||
import de.bixilon.minosoft.data.registries.ResourceLocation
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolDefinition
|
||||
import de.bixilon.minosoft.util.KUtil.toResourceLocation
|
||||
import de.bixilon.minosoft.util.logging.Log
|
||||
import net.sourceforge.argparse4j.ArgumentParsers
|
||||
import net.sourceforge.argparse4j.impl.Arguments
|
||||
import net.sourceforge.argparse4j.inf.ArgumentParserException
|
||||
import net.sourceforge.argparse4j.inf.Namespace
|
||||
import kotlin.system.exitProcess
|
||||
import java.io.PrintWriter
|
||||
|
||||
object CommandLineArguments {
|
||||
lateinit var ARGUMENTS: List<String>
|
||||
@ -92,8 +95,8 @@ object CommandLineArguments {
|
||||
try {
|
||||
namespace = PARSER.parseArgs(args)
|
||||
} catch (exception: ArgumentParserException) {
|
||||
PARSER.handleError(exception)
|
||||
exitProcess(1)
|
||||
PARSER.handleError(exception, PrintWriter(Log.FATAL_PRINT_STREAM))
|
||||
return ShutdownManager.shutdown(reason = AbstractShutdownReason.CRASH)
|
||||
}
|
||||
|
||||
RunConfiguration.LOG_COLOR_MESSAGE = namespace.getBoolean("disable_log_color_message")
|
||||
|
@ -80,7 +80,7 @@ object Log {
|
||||
messageToSend.message.setFallbackColor(messageColor)
|
||||
}
|
||||
|
||||
val stream = if (messageToSend.logMessageType.error) {
|
||||
val stream = if (messageToSend.level.error) {
|
||||
SYSTEM_ERR_STREAM
|
||||
} else {
|
||||
SYSTEM_OUT_STREAM
|
||||
|
@ -17,9 +17,9 @@ import de.bixilon.minosoft.data.text.formatting.color.ChatColors
|
||||
import de.bixilon.minosoft.data.text.formatting.color.Colors
|
||||
import de.bixilon.minosoft.data.text.formatting.color.RGBColor
|
||||
|
||||
enum class LogLevels(val levelColors: RGBColor) {
|
||||
FATAL(Colors.DARK_RED),
|
||||
WARN(ChatColors.RED),
|
||||
enum class LogLevels(val levelColors: RGBColor, val error: Boolean = false) {
|
||||
FATAL(Colors.DARK_RED, true),
|
||||
WARN(ChatColors.RED, true),
|
||||
INFO(ChatColors.WHITE),
|
||||
VERBOSE(ChatColors.YELLOW),
|
||||
;
|
||||
|
@ -21,7 +21,6 @@ enum class LogMessageType(
|
||||
val defaultColor: RGBColor,
|
||||
val colorMap: Map<LogLevels, RGBColor> = emptyMap(),
|
||||
val defaultLevel: LogLevels = LogLevels.INFO,
|
||||
val error: Boolean = false,
|
||||
) {
|
||||
AUTO_CONNECT(ChatColors.WHITE),
|
||||
GENERAL(ChatColors.WHITE),
|
||||
|
@ -34,4 +34,8 @@ class LogPrintStream(
|
||||
}
|
||||
Log.log(message = string, type = type, level = level)
|
||||
}
|
||||
|
||||
override fun write(buf: ByteArray, off: Int, len: Int) {
|
||||
print(String(buf).substring(off, len)) // ToDo: Optimize
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user