From ae52ab7e53d0df199121fc327ef33e2510f9bd8e Mon Sep 17 00:00:00 2001 From: crschnick Date: Mon, 1 Jan 2024 14:24:26 +0000 Subject: [PATCH] Rework shell dialect names for bsd sh support --- .../io/xpipe/core/process/ShellDialect.java | 2 ++ .../io/xpipe/core/process/ShellDialects.java | 30 ++++++++++--------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/core/src/main/java/io/xpipe/core/process/ShellDialect.java b/core/src/main/java/io/xpipe/core/process/ShellDialect.java index 8c8e168e7..6aac9ad84 100644 --- a/core/src/main/java/io/xpipe/core/process/ShellDialect.java +++ b/core/src/main/java/io/xpipe/core/process/ShellDialect.java @@ -26,6 +26,8 @@ public interface ShellDialect { .collect(Collectors.joining(" ")); } + String getExecutableName(); + default boolean isSupportedShell() { return true; } diff --git a/core/src/main/java/io/xpipe/core/process/ShellDialects.java b/core/src/main/java/io/xpipe/core/process/ShellDialects.java index 9d35c68fe..8acbfaf89 100644 --- a/core/src/main/java/io/xpipe/core/process/ShellDialects.java +++ b/core/src/main/java/io/xpipe/core/process/ShellDialects.java @@ -15,6 +15,7 @@ public class ShellDialects { public static ShellDialect CMD; public static ShellDialect ASH; public static ShellDialect SH; + public static ShellDialect SH_BSD; public static ShellDialect DASH; public static ShellDialect BASH; public static ShellDialect ZSH; @@ -35,19 +36,20 @@ public class ShellDialects { ALL.add(moduleLayerLoaderProvider.get()); }); - CMD = byName("cmd"); - POWERSHELL = byName("powershell"); - POWERSHELL_CORE = byName("pwsh"); - OPNSENSE = byName("opnsense"); - FISH = byName("fish"); - DASH = byName("dash"); - BASH = byName("bash"); - ZSH = byName("zsh"); - CSH = byName("csh"); - ASH = byName("ash"); - SH = byName("sh"); - UNSUPPORTED = byName("unsupported"); - CISCO = byName("cisco"); + CMD = byId("cmd"); + POWERSHELL = byId("powershell"); + POWERSHELL_CORE = byId("pwsh"); + OPNSENSE = byId("opnsense"); + FISH = byId("fish"); + DASH = byId("dash"); + BASH = byId("bash"); + ZSH = byId("zsh"); + CSH = byId("csh"); + ASH = byId("ash"); + SH = byId("sh"); + SH_BSD = byId("shBsd"); + UNSUPPORTED = byId("unsupported"); + CISCO = byId("cisco"); } @Override @@ -61,7 +63,7 @@ public class ShellDialects { } } - private static ShellDialect byName(String name) { + private static ShellDialect byId(String name) { return ALL.stream() .filter(shellType -> shellType.getId().equals(name)) .findFirst()