From 1f716f0307d22c3837a091aae954118bb59b433e Mon Sep 17 00:00:00 2001 From: Gravit Date: Sat, 13 Apr 2019 06:27:48 +0700 Subject: [PATCH] =?UTF-8?q?[FEATURE]=20=D0=A0=D0=B0=D0=B7=D1=83=D0=BA?= =?UTF-8?q?=D1=80=D0=B0=D1=88=D0=B5=D0=BD=D1=8B=D0=B9=20help?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../launchserver/command/basic/HelpCommand.java | 16 +++++++++++++++- .../java/ru/gravit/utils/helper/LogHelper.java | 5 +++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/command/basic/HelpCommand.java b/LaunchServer/src/main/java/ru/gravit/launchserver/command/basic/HelpCommand.java index b5c24dbd..1550742f 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/command/basic/HelpCommand.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/command/basic/HelpCommand.java @@ -1,5 +1,6 @@ package ru.gravit.launchserver.command.basic; +import org.fusesource.jansi.Ansi; import ru.gravit.launchserver.LaunchServer; import ru.gravit.utils.command.Command; import ru.gravit.utils.command.CommandCategory; @@ -13,7 +14,20 @@ public final class HelpCommand extends ru.gravit.launchserver.command.Command { private static void printCommand(String name, Command command) { String args = command.getArgsDescription(); - LogHelper.subInfo("%s %s - %s", name, args == null ? "[nothing]" : args, command.getUsageDescription()); + //LogHelper.subInfo("%s %s - %s", name, args == null ? "[nothing]" : args, command.getUsageDescription()); + LogHelper.rawLog(() -> LogHelper.rawFormat(LogHelper.Level.INFO, LogHelper.getDataTime(), true) + String.format("%s %s - %s", name, args == null ? "[nothing]" : args, command.getUsageDescription()), () -> { + Ansi ansi = LogHelper.rawAnsiFormat(LogHelper.Level.INFO, LogHelper.getDataTime(), true); + ansi.fgBright(Ansi.Color.GREEN); + ansi.a(name + " "); + ansi.fgBright(Ansi.Color.CYAN); + ansi.a(args == null ? "[nothing]": args); + ansi.reset(); + ansi.a(" - "); + ansi.fgBright(Ansi.Color.YELLOW); + ansi.a(command.getUsageDescription()); + ansi.reset(); + return ansi.toString(); + }); } private static void printCategory(String name, String description) diff --git a/libLauncher/src/main/java/ru/gravit/utils/helper/LogHelper.java b/libLauncher/src/main/java/ru/gravit/utils/helper/LogHelper.java index a5667c48..53c86d62 100644 --- a/libLauncher/src/main/java/ru/gravit/utils/helper/LogHelper.java +++ b/libLauncher/src/main/java/ru/gravit/utils/helper/LogHelper.java @@ -160,6 +160,11 @@ public static void setDevEnabled(boolean stacktraceEnabled) { DEV_ENABLED.set(stacktraceEnabled); } + public static String getDataTime() + { + return DATE_TIME_FORMATTER.format(LocalDateTime.now()); + } + @LauncherAPI public static void log(Level level, String message, boolean sub) { String dateTime = DATE_TIME_FORMATTER.format(LocalDateTime.now());