Fix ssh git integration

This commit is contained in:
crschnick 2023-12-14 03:59:20 +00:00
parent 102b69f261
commit 3afbb2ed0a

View file

@ -62,6 +62,14 @@ public class CommandBuilder {
return this; return this;
} }
public CommandBuilder add(int index, String... s) {
for (String s1 : s) {
elements.add(index++, new Fixed(s1));
}
return this;
}
public CommandBuilder remove(String s) { public CommandBuilder remove(String s) {
elements.removeIf(element -> element instanceof Fixed fixed && s.equals(fixed.string)); elements.removeIf(element -> element instanceof Fixed fixed && s.equals(fixed.string));
return this; return this;
@ -82,6 +90,21 @@ public class CommandBuilder {
return this; return this;
} }
public CommandBuilder addQuoted(int index, String s) {
elements.add(index, sc -> {
if (s == null) {
return null;
}
if (sc == null) {
return "\"" + s + "\"";
}
return sc.getShellDialect().quoteArgument(s);
});
return this;
}
public CommandBuilder addSub(CommandBuilder sub) { public CommandBuilder addSub(CommandBuilder sub) {
elements.add(sc -> { elements.add(sc -> {
if (sc == null) { if (sc == null) {