1 parent 147c0ab commit b0514b2Copy full SHA for b0514b2
1 file changed
src/windows/WindowsProgram.java
@@ -0,0 +1,20 @@
1
+package windows;
2
+
3
+import java.nio.file.Path;
4
+import java.util.ArrayList;
5
+import java.util.List;
6
7
+/** Describes a Windows executable or command without executing it. */
8
+public record WindowsProgram(String name, Path executable) {
9
+ public WindowsProgram {
10
+ if (name == null || name.isBlank()) throw new IllegalArgumentException("name is required");
11
+ if (executable == null) throw new IllegalArgumentException("executable is required");
12
+ }
13
14
+ public List<String> command(List<String> arguments) {
15
+ List<String> command = new ArrayList<>();
16
+ command.add(executable.toString());
17
+ command.addAll(arguments);
18
+ return List.copyOf(command);
19
20
+}
0 commit comments