From 14268d232404ce66d5b54311b182a98d475e52e6 Mon Sep 17 00:00:00 2001 From: crschnick Date: Mon, 13 May 2024 15:18:25 +0000 Subject: [PATCH] Add index based command builder element add --- .../main/java/io/xpipe/core/process/CommandBuilder.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/src/main/java/io/xpipe/core/process/CommandBuilder.java b/core/src/main/java/io/xpipe/core/process/CommandBuilder.java index d34d36eb..3e290484 100644 --- a/core/src/main/java/io/xpipe/core/process/CommandBuilder.java +++ b/core/src/main/java/io/xpipe/core/process/CommandBuilder.java @@ -97,6 +97,13 @@ public class CommandBuilder { return this; } + public CommandBuilder add(int index, Element... s) { + for (var s1 : s) { + elements.add(index++, s1); + } + return this; + } + public CommandBuilder remove(String s) { elements.removeIf(element -> element instanceof Fixed fixed && s.equals(fixed.string)); return this;