mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-24 00:20:24 +00:00
Reformat
This commit is contained in:
parent
c084a55d15
commit
f0fe0d7a6e
2 changed files with 19 additions and 16 deletions
|
@ -7,7 +7,6 @@ import io.xpipe.app.fxcomps.Comp;
|
|||
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 @@ public class LoggingCategory extends AppPrefsCategory {
|
|||
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()
|
||||
|
|
|
@ -69,7 +69,9 @@ public class TerminalLauncher {
|
|||
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 @@ public class TerminalLauncher {
|
|||
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 @@ public class TerminalLauncher {
|
|||
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());
|
||||
|
|
Loading…
Reference in a new issue