diff --git a/README.md b/README.md index 696bd73..610c40f 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ exec { ### `args` -The full command line arguments including the executable and all parameters. +The full command line including the executable and all arguments. ```kotlin exec { @@ -74,9 +74,12 @@ The following predefined values are available: Name | Operating System --------------|----------------------- +`Os.CYGWIN` | Cygwin `Os.FREEBSD` | FreeBSD `Os.LINUX` | Linux `Os.MAC` | Apple Macintosh / OS X +`Os.MINGW` | Minimalist GNU for Windows +`OS.MSYS` | MSYS `Os.OPENVMS` | OpenVMS `Os.OS400` | OS/400 `Os.SOLARIS` | Solaris / SunOS @@ -118,7 +121,7 @@ exec { ## taskName -Additionally, you can specify a task name to easily identify multiple `exec` directives. +Additionally, you can specify a task name to easily identify multiple `exec` tasks. ```kotlin exec { @@ -162,7 +165,4 @@ exec { commandLine("/bin/sh", "-c", "./stop.sh 2> error.txt", os = setOf(Os.LINUX)) commandLine("cmd", "/c", "stop.bat 2> error.txt", os = setOf(Os.WINDOWS)) } -``` - - - +``` \ No newline at end of file diff --git a/src/main/kotlin/net/thauvin/erik/kobalt/plugin/exec/ExecPlugin.kt b/src/main/kotlin/net/thauvin/erik/kobalt/plugin/exec/ExecPlugin.kt index 066c695..ac5f138 100644 --- a/src/main/kotlin/net/thauvin/erik/kobalt/plugin/exec/ExecPlugin.kt +++ b/src/main/kotlin/net/thauvin/erik/kobalt/plugin/exec/ExecPlugin.kt @@ -102,6 +102,18 @@ class ExecPlugin @Inject constructor(val taskContributor: TaskContributor, val c Os.OS400 -> { return curOs.contains("os/400") } + Os.CYGWIN -> { + val cygwin: String? = System.getenv("ORIGINAL_PATH") + return cygwin?.contains("/cygdrive/") ?: false + } + Os.MINGW -> { + val mingw: String? = System.getenv("MSYSTEM") + return mingw?.startsWith("MINGW") ?: false + } + Os.MSYS -> { + val msys: String? = System.getenv("MSYSTEM") + return msys?.startsWith("MSYS") ?: false + } } } @@ -184,7 +196,7 @@ enum class Fail { } enum class Os { - FREEBSD, LINUX, MAC, OPENVMS, OS400, SOLARIS, TANDEM, WINDOWS, ZOS + CYGWIN, FREEBSD, LINUX, MAC, MINGW, MSYS, OPENVMS, OS400, SOLARIS, TANDEM, WINDOWS, ZOS } data class CommandLine(var args: List = emptyList(), var dir: String = "", var os: Set = emptySet(),