mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-04-24 16:40:58 -04:00
Merge branch better-commands
This commit is contained in:
@@ -210,7 +210,11 @@ public class CommandBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String buildCommandBase(ShellControl sc) throws Exception {
|
||||
public String buildBase(ShellControl sc) throws Exception {
|
||||
return String.join(" ", buildBaseParts(sc));
|
||||
}
|
||||
|
||||
public List<String> buildBaseParts(ShellControl sc) throws Exception {
|
||||
countDown = CountDown.of();
|
||||
uuid = UUID.randomUUID();
|
||||
|
||||
@@ -227,11 +231,11 @@ public class CommandBuilder {
|
||||
|
||||
list.add(evaluate);
|
||||
}
|
||||
return String.join(" ", list);
|
||||
return list;
|
||||
}
|
||||
|
||||
public String buildString(ShellControl sc) throws Exception {
|
||||
var s = buildCommandBase(sc);
|
||||
public String buildFull(ShellControl sc) throws Exception {
|
||||
var s = buildBase(sc);
|
||||
LinkedHashMap<String, String> map = new LinkedHashMap<>();
|
||||
for (var e : environmentVariables.entrySet()) {
|
||||
var v = e.getValue().evaluate(sc);
|
||||
@@ -239,7 +243,7 @@ public class CommandBuilder {
|
||||
map.put(e.getKey(), v);
|
||||
}
|
||||
}
|
||||
return sc.getShellDialect().addInlineVariablesToCommand(map, s);
|
||||
return sc.getShellDialect().assembleCommand(s, map);
|
||||
}
|
||||
|
||||
public CommandControl build(ShellControl sc) {
|
||||
|
||||
@@ -16,6 +16,8 @@ import java.util.stream.Stream;
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
|
||||
public interface ShellDialect {
|
||||
|
||||
CommandBuilder launchAsnyc(CommandBuilder cmd);
|
||||
|
||||
default String getLicenseFeatureId() {
|
||||
return null;
|
||||
}
|
||||
@@ -80,7 +82,7 @@ public interface ShellDialect {
|
||||
|
||||
String getScriptFileEnding();
|
||||
|
||||
String addInlineVariablesToCommand(Map<String, String> variables, String command);
|
||||
String assembleCommand(String command, Map<String, String> variables);
|
||||
|
||||
Stream<FileSystem.FileEntry> listFiles(FileSystem fs, ShellControl control, String dir) throws Exception;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user