Skip to content

Commit edf9dbb

Browse files
committed
fixed self-update version check to include patch level
1 parent 97174ab commit edf9dbb

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ Support API
138138

139139
`kscript` is complemented by a [support library](https://github.com/holgerbrandl/kscript-support-api) to ease the writing of Kotlin scriptlets. The latter includes solutions to common use-cases like argument parsing, data streaming, IO utilities, and various iterators to streamline the development of kscript applications.
140140

141-
When using the direct script arguments (like in the example below) the methods in the the `kscript.*` namespace and the corresponding dependency `de.mpicbg.scicomp:kscript:1.2` are automatically added as prefix to the script by convention. This allows for sed-like constructs like
141+
When using the direct script arguments (like in the example below) the methods in the the `kscript.*` namespace and the corresponding dependency `de.mpicbg.scicomp:kscript:1.2.1` are automatically added as prefix to the script by convention. This allows for sed-like constructs like
142142

143143
```bash
144144
cat some_file | kscript 'stdin.filter { "^de0[-0]*".toRegex().matches(it) }.map { it + "foo:" }.print()'

kscript

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22

3-
KSCRIPT_VERSION=1.4.1
3+
## note: always use a patch release even if it's 0
4+
KSCRIPT_VERSION=1.4.2
45

56
## make sure that all requirements (java, kotlinc, maven) to run kscript are met
67
assertInPath(){ if [ -z "$(which $1)" ]; then echo "[ERROR] Could not locate '$1'" 1>&2; exit 1; fi }
@@ -36,10 +37,11 @@ if [ $# == 0 ] || [ "$1" == "-v" ] || [ "$1" == "--version" ] || [ "$1" == "-h"
3637
echo "Website : https://github.com/holgerbrandl/kscript" >&2
3738

3839
## determine the latest version
39-
latestVersion=$(curl -Ls https://git.io/v9R73 | grep '^KSCRIPT_VERSION' | cut -f2 -d'=')
40+
latestVersion=$(curl -Ls https://git.io/v9R73 | grep '^KSCRIPT_VERSION' | cut -f2 -d'=' | tr -d '.')
41+
installedVersion=$(echo $KSCRIPT_VERSION | tr -d '.')
4042

4143
## http://stackoverflow.com/questions/15224581/floating-point-comparison-with-variable-in-bash
42-
if [ $(echo " $latestVersion > $KSCRIPT_VERSION" | bc) -eq 1 ]; then
44+
if [ $(echo " ${latestVersion} > ${installedVersion}" | bc) -eq 1 ]; then
4345
bold=$(tput bold); normal=$(tput sgr0) ## http://stackoverflow.com/questions/2924697/how-does-one-output-bold-text-in-bash
4446
echo -e "\n${bold}A new version of kscript is available. Use 'kscript --self-update' to update your local kscript installation" >&2
4547
fi

0 commit comments

Comments
 (0)