From 16071c0e75a872f29397c14e0e4f19d6e98dbc6e Mon Sep 17 00:00:00 2001 From: crschnick Date: Sat, 30 Dec 2023 02:20:21 +0000 Subject: [PATCH] Cleanup shell control --- .../xpipe/app/browser/OpenFileSystemModel.java | 2 +- .../io/xpipe/core/process/ShellControl.java | 18 +++--------------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/browser/OpenFileSystemModel.java b/app/src/main/java/io/xpipe/app/browser/OpenFileSystemModel.java index 376444ee1..e76a0bd29 100644 --- a/app/src/main/java/io/xpipe/app/browser/OpenFileSystemModel.java +++ b/app/src/main/java/io/xpipe/app/browser/OpenFileSystemModel.java @@ -162,7 +162,7 @@ public final class OpenFileSystemModel { fileSystem .getShell() .get() - .subShell(adjustedPath) + .subShell(processControl -> adjustedPath, (sc) -> adjustedPath) .withInitSnippet(new SimpleScriptSnippet( fileSystem .getShell() diff --git a/core/src/main/java/io/xpipe/core/process/ShellControl.java b/core/src/main/java/io/xpipe/core/process/ShellControl.java index 41b40a90c..f4b7e5a4c 100644 --- a/core/src/main/java/io/xpipe/core/process/ShellControl.java +++ b/core/src/main/java/io/xpipe/core/process/ShellControl.java @@ -13,7 +13,6 @@ import java.util.UUID; import java.util.concurrent.locks.ReentrantLock; import java.util.function.Consumer; import java.util.function.Function; -import java.util.function.Predicate; public interface ShellControl extends ProcessControl { @@ -62,14 +61,6 @@ public interface ShellControl extends ProcessControl { }); } - default ShellControl withSupportCheckInit(Predicate predicate, String name) { - return onInit(shellControl -> { - if (!predicate.test(shellControl)) { - - } - }); - } - default ShellControl withShellStateFail(StatefulDataStore store) { return onFail(shellControl -> { var s = store.getState(); @@ -197,12 +188,9 @@ public interface ShellControl extends ProcessControl { } default ShellControl identicalSubShell() { - return subShell(p -> p.getShellDialect().getLoginOpenCommand(), (sc) -> sc.getShellDialect().getLoginOpenCommand()) - .elevationPassword(getElevationPassword()); - } - - default ShellControl subShell(@NonNull String command) { - return subShell(processControl -> command, (sc) -> command); + return subShell(p -> p.getShellDialect().getLoginOpenCommand(), + (sc) -> sc.getShellDialect().getLoginOpenCommand() + ).elevationPassword(getElevationPassword()); } default T enforceDialect(@NonNull ShellDialect type, FailableFunction sc) throws Exception {