Skip to content

Commit cb58932

Browse files
committed
Added setup info to error message (relates to #79)
1 parent fb63f1f commit cb58932

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,9 @@ kscript --idea CountRecords.kts
381381
```
382382
This will open [IntelliJ IDEA](https://www.jetbrains.com/idea/) with a minimalistic project containing just your (1) `<script>` and (2) a generated `gradle.build` file:
383383

384-
This assumes that you have a command line launcher named `idea`. Add one from Intellij via the `tools -> Create Command-line Launcher` option.
385-
386384
![](misc/readme_images/minus_idea.png)
387385

386+
This assumes that you have the Intellij IDEA command line launcher `idea` in your `PATH`. It can be created in IntelliJ under `Tools -> Create Command-line Launcher`
388387

389388
FAQ
390389
---

src/main/kotlin/kscript/app/AppHelpers.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ object ShellUtils {
9494

9595
fun isInPath(tool: String) = evalBash("which $tool").stdout.trim().isNotBlank()
9696

97-
fun requireInPath(tool: String) = errorIf(!isInPath(tool)) { "$tool is not in PATH" }
97+
fun requireInPath(tool: String, msg: String = "$tool is not in PATH") = errorIf(!isInPath(tool)) { msg }
9898

9999
}
100100

@@ -193,7 +193,7 @@ fun info(msg: String) = System.err.println(msg)
193193

194194

195195
fun launchIdeaWithKscriptlet(scriptFile: File, dependencies: List<String>, customRepos: List<MavenRepo>): String {
196-
requireInPath("idea")
196+
requireInPath("idea", "Could not find 'idea' in your PATH. It can be created in IntelliJ under `Tools -> Create Command-line Launcher`")
197197

198198
System.err.println("Setting up idea project from ${scriptFile}")
199199

0 commit comments

Comments
 (0)