Merge branch 1.7.3 into master

This commit is contained in:
crschnick
2023-11-04 05:36:47 +00:00
parent 8ef97ccc9f
commit bc7bde024a
59 changed files with 449 additions and 276 deletions

View File

@@ -0,0 +1,35 @@
package io.xpipe.core.process;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
public interface ScriptSnippet {
@Getter
public static enum ExecutionType {
@JsonProperty("dumbOnly")
DUMB_ONLY("dumbOnly"),
@JsonProperty("terminalOnly")
TERMINAL_ONLY("terminalOnly"),
@JsonProperty("both")
BOTH("both");
private final String id;
ExecutionType(String id) {
this.id = id;
}
public boolean runInDumb() {
return this == DUMB_ONLY || this == BOTH;
}
public boolean runInTerminal() {
return this == TERMINAL_ONLY || this == BOTH;
}
}
String content(ShellControl shellControl);
ExecutionType executionType();
}

View File

@@ -15,6 +15,8 @@ import java.util.function.Predicate;
public interface ShellControl extends ProcessControl {
List<ScriptSnippet> getInitCommands();
ShellControl withTargetTerminalShellDialect(ShellDialect d);
ShellDialect getTargetTerminalShellDialect();
@@ -153,11 +155,7 @@ public interface ShellControl extends ProcessControl {
}
ShellControl elevationPassword(FailableSupplier<SecretValue> value);
ShellControl initWith(String cmds);
ShellControl initWithDumb(String cmds);
ShellControl initWithTerminal(String cmds);
ShellControl initWith(ScriptSnippet snippet);
ShellControl additionalTimeout(int ms);

View File

@@ -26,6 +26,10 @@ public interface ShellDialect {
.collect(Collectors.joining(" "));
}
default boolean isSupportedShell() {
return true;
}
default boolean isSelectable() {
return true;
}
@@ -40,7 +44,7 @@ public interface ShellDialect {
String getCatchAllVariable();
CommandControl queryVersion(ShellControl shellControl);
String queryVersion(ShellControl shellControl) throws Exception;
CommandControl prepareUserTempDirectory(ShellControl shellControl, String directory);

View File

@@ -20,6 +20,8 @@ public class ShellDialects {
public static ShellDialect ZSH;
public static ShellDialect CSH;
public static ShellDialect FISH;
public static ShellDialect UNSUPPORTED;
public static ShellDialect CISCO;
public static class Loader implements ModuleLayerLoader {
@@ -40,6 +42,8 @@ public class ShellDialects {
CSH = byName("csh");
ASH = byName("ash");
SH = byName("sh");
UNSUPPORTED = byName("unsupported");
CISCO = byName("cisco");
}
@Override

View File

@@ -0,0 +1,26 @@
package io.xpipe.core.process;
import lombok.NonNull;
public class SimpleScriptSnippet implements ScriptSnippet {
@NonNull
private final String content;
@NonNull
private final ExecutionType executionType;
public SimpleScriptSnippet(@NonNull String content, @NonNull ExecutionType executionType) {
this.content = content;
this.executionType = executionType;
}
@Override
public String content(ShellControl shellControl) {
return content;
}
@Override
public ExecutionType executionType() {
return executionType;
}
}