Skip to content

Commit c9f515e

Browse files
committed
Removed --self-update (relates to #102)
1 parent 3eb42fa commit c9f515e

File tree

4 files changed

+3
-40
lines changed

4 files changed

+3
-40
lines changed

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Taken all these features together, `kscript` provides an easy-to-use, very flexi
3434
- [Treat yourself a REPL with `--interactive`](#treat-yourself-a-repl-with---interactive)
3535
- [Boostrap IDEA from a `kscript`let](#boostrap-idea-from-a-kscriptlet)
3636
- [Deploy scripts as standalone binaries](#deploy-scripts-as-standalone-binaries)
37-
- [Embed kscript installer within a script](#embed-kscript-installer-within-a-script)
37+
- [Embed kscript installer within your script](#embed-kscript-installer-within-your-script)
3838
- [FAQ](#faq)
3939
- [Support](#support)
4040
- [How to contribute?](#how-to-contribute)
@@ -63,10 +63,7 @@ To test your installation simply run
6363
kscript --help
6464
```
6565

66-
`kscript` can update itself to its latest version by running
67-
```bash
68-
kscript --self-update
69-
```
66+
This will check and inform about udpates. To update `kscript` simply install it again as described above.
7067

7168
#### Installation without `sdkman`
7269

examples/classpath_example.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ Usage:
1919
kscript ( -t | --text ) <version>
2020
kscript [ --interactive | --idea | --package ] [--] ( - | <file or URL> ) [<args>]...
2121
kscript (-h | --help)
22-
kscript ( --self-update | --clear-cache )
2322
2423
Options:
2524
-t, --text Enable stdin support API for more streamlined text processing [default: latest]
@@ -28,7 +27,6 @@ Options:
2827
-i, --interactive Create interactive shell with dependencies as declared in script
2928
- Read script from the STDIN
3029
-h, --help Print this text
31-
--self-update Update kscript to the latest version
3230
--clear-cache Wipe cached script jars and urls
3331
"""
3432

misc/docker_tests.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ docker attach `docker ps -q -l` # reattach the terminal & stdin
2626
#curl -Lso /bin/kscript https://www.dropbox.com/s/l5g8vr0wz78y3zy/kscript?dl=1 && chmod u+x /bin/kscript
2727

2828
#kscript --help
29-
#kscript --self-update
3029

3130

3231
## or using github repo

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

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,10 @@ $selfName - Enhanced scripting support for Kotlin on *nix-based systems.
3131
Usage:
3232
$selfName [options] <script> [<script_args>]...
3333
$selfName --clear-cache
34-
$selfName --self-update
3534
3635
The <script> can be a script file (*kts), a script URL, - for stdin, a *.kt source file with a main method, or some kotlin code.
3736
3837
Use '--clear-cache' to wipe cached script jars and urls
39-
Use '--self-update' to update kscript to the latest version
4038
4139
Options:
4240
-i --interactive Create interactive shell with dependencies as declared in script
@@ -103,35 +101,6 @@ fun main(args: Array<String>) {
103101
quit(0)
104102
}
105103

106-
// optionally self-update kscript ot the newest version
107-
// (if not local copy is not being maintained by sdkman)
108-
if (docopt.getBoolean(("self-update"))) {
109-
if (true || evalBash("which kscript | grep .sdkman").stdout.isNotBlank()) {
110-
info("Installing latest version of kscript...")
111-
// println("sdkman_auto_answer=true && sdk install kscript")
112-
113-
// create update script
114-
val updateScript = File(KSCRIPT_CACHE_DIR, "self_update.sh").apply {
115-
writeText("""
116-
#!/usr/bin/env bash
117-
export SDKMAN_DIR="${"$"}{HOME}/.sdkman"
118-
source "${"$"}{SDKMAN_DIR}/bin/sdkman-init.sh"
119-
sdkman_auto_answer=true && sdk install kscript
120-
""".trimIndent())
121-
setExecutable(true)
122-
}
123-
124-
println(updateScript.absolutePath)
125-
} else {
126-
info("Self-update is currently just supported via sdkman.")
127-
info("Please download a new release from https://github.com/holgerbrandl/kscript")
128-
// todo port sdkman-indpendent self-update
129-
}
130-
131-
quit(0)
132-
}
133-
134-
135104
// Resolve the script resource argument into an actual file
136105
val scriptResource = docopt.getString("script")
137106

@@ -338,7 +307,7 @@ private fun versionCheck() {
338307
fun padVersion(version: String) = java.lang.String.format("%03d%03d%03d", *version.split(".").map { Integer.valueOf(it) }.toTypedArray())
339308

340309
if (padVersion(latestVersion) > padVersion(KSCRIPT_VERSION)) {
341-
info("""A new version (v${latestVersion}) of kscript is available. Use 'kscript --self-update' to update your local kscript installation""")
310+
info("""A new version (v${latestVersion}) of kscript is available.""")
342311
}
343312
}
344313

0 commit comments

Comments
 (0)