From f0fe0d7a6e51ca4cb550da9bfc060a78bfefefce Mon Sep 17 00:00:00 2001 From: crschnick Date: Thu, 17 Oct 2024 09:41:41 +0000 Subject: [PATCH] Reformat --- .../io/xpipe/app/prefs/LoggingCategory.java | 6 +--- .../io/xpipe/app/util/TerminalLauncher.java | 29 ++++++++++++------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/prefs/LoggingCategory.java b/app/src/main/java/io/xpipe/app/prefs/LoggingCategory.java index b4348b901..080f13085 100644 --- a/app/src/main/java/io/xpipe/app/prefs/LoggingCategory.java +++ b/app/src/main/java/io/xpipe/app/prefs/LoggingCategory.java @@ -7,7 +7,6 @@ import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.util.DesktopHelper; import io.xpipe.app.util.LicenseProvider; -import io.xpipe.app.util.LicensedFeature; import io.xpipe.app.util.OptionsBuilder; import java.io.IOException; @@ -25,10 +24,7 @@ protected Comp create() { var prefs = AppPrefs.get(); var feature = LicenseProvider.get().getFeature("logging"); var supported = feature.isSupported() || feature.isPreviewSupported(); - var title = AppI18n.observable("sessionLogging") - .map(s -> s + (supported - ? "" - : " (Pro)")); + var title = AppI18n.observable("sessionLogging").map(s -> s + (supported ? "" : " (Pro)")); return new OptionsBuilder() .addTitle(title) .sub(new OptionsBuilder() diff --git a/app/src/main/java/io/xpipe/app/util/TerminalLauncher.java b/app/src/main/java/io/xpipe/app/util/TerminalLauncher.java index 70e7fd265..061193508 100644 --- a/app/src/main/java/io/xpipe/app/util/TerminalLauncher.java +++ b/app/src/main/java/io/xpipe/app/util/TerminalLauncher.java @@ -69,7 +69,9 @@ public static void open(DataStoreEntry entry, String title, String directory, Pr var log = AppPrefs.get().enableTerminalLogging().get(); var terminalConfig = new TerminalInitScriptConfig( adjustedTitle, - !log && type.shouldClear() && AppPrefs.get().clearTerminalOnInit().get(), + !log + && type.shouldClear() + && AppPrefs.get().clearTerminalOnInit().get(), cc instanceof ShellControl ? type.additionalInitCommands() : TerminalInitFunction.none()); var request = UUID.randomUUID(); var config = createConfig(request, entry, cleanTitle, adjustedTitle); @@ -97,8 +99,7 @@ private static ExternalTerminalType.LaunchConfiguration createConfig( var preparationScript = ScriptHelper.createLocalExecScript(launcherScript); var feature = LicenseProvider.get().getFeature("logging"); - var supported = feature - .isSupported(); + var supported = feature.isSupported(); if (!supported) { throw new LicenseRequiredException(feature); } @@ -134,23 +135,29 @@ private static ExternalTerminalType.LaunchConfiguration createConfig( entry != null ? color : null, adjustedTitle, cleanTitle, ps, ShellDialects.POWERSHELL); return config; } else { - var found = sc.command(sc.getShellDialect().getWhichCommand("script")).executeAndCheck(); + var found = sc.command(sc.getShellDialect().getWhichCommand("script")) + .executeAndCheck(); if (!found) { - var suffix = sc.getOsType() == OsType.MACOS ? "This command is available in the util-linux package which can be installed via homebrew." : "This command is available in the util-linux package."; - throw ErrorEvent.expected(new IllegalStateException("Logging requires the script command to be installed. " + suffix)); + var suffix = sc.getOsType() == OsType.MACOS + ? "This command is available in the util-linux package which can be installed via homebrew." + : "This command is available in the util-linux package."; + throw ErrorEvent.expected(new IllegalStateException( + "Logging requires the script command to be installed. " + suffix)); } - var content = sc.getOsType() == OsType.MACOS || sc.getOsType() == OsType.BSD ? - """ + var content = sc.getOsType() == OsType.MACOS || sc.getOsType() == OsType.BSD + ? """ echo "Transcript started, output file is sessions/%s" script -e -q "%s" "%s" echo "Transcript stopped, output file is sessions/%s" - """.formatted(logFile.getFileName(), logFile, preparationScript, logFile.getFileName()) : - """ + """ + .formatted(logFile.getFileName(), logFile, preparationScript, logFile.getFileName()) + : """ echo "Transcript started, output file is sessions/%s" script --quiet --command "%s" "%s" echo "Transcript stopped, output file is sessions/%s" - """.formatted(logFile.getFileName(), preparationScript, logFile, logFile.getFileName()); + """ + .formatted(logFile.getFileName(), preparationScript, logFile, logFile.getFileName()); var ps = ScriptHelper.createExecScript(sc.getShellDialect(), sc, content); var config = new ExternalTerminalType.LaunchConfiguration( entry != null ? color : null, adjustedTitle, cleanTitle, ps, sc.getShellDialect());