mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[FEATURE] Разукрашеный help
This commit is contained in:
parent
da1fed63bd
commit
1f716f0307
2 changed files with 20 additions and 1 deletions
|
@ -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)
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Reference in a new issue