File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
src/main/kotlin/kscript/app Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ import org.docopt.DocOptWrapper
1818 * @author Marcin Kuszczak
1919 */
2020
21- const val KSCRIPT_VERSION = " 4.0.2 "
21+ const val KSCRIPT_VERSION = " 4.0.3 "
2222
2323fun main (args : Array <String >) {
2424 try {
Original file line number Diff line number Diff line change @@ -8,9 +8,12 @@ enum class OsType(val osName: String) {
88 fun isUnixHostedOnWindows () = (this == CYGWIN || this == MSYS )
99
1010 companion object {
11- fun findOrThrow (name : String ) =
12- // Exact comparison (it.osName.equals(name, true)) seems to be not feasible as there is also e.g. "darwin21"
13- // and maybe even other osTypes: specific versions of os'es shouldn't belong to OsType.
14- values().find { name.contains(it.osName, true ) } ? : throw IllegalArgumentException (" Unsupported OS: $name " )
11+ fun findOrThrow (name : String ): OsType {
12+ // Exact comparison (it.osName.equals(name, true)) seems to be not feasible as there is also e.g. "darwin21"
13+ // "darwin19" and maybe even other osTypes. It seems though that startsWith() is covering all cases.
14+ // https://github.com/holgerbrandl/kscript/issues/356
15+ return values().find { name.startsWith(it.osName, true ) }
16+ ? : throw IllegalArgumentException (" Unsupported OS: $name " )
17+ }
1518 }
1619}
You can’t perform that action at this time.
0 commit comments