|
6 | 6 | # - env-variable `MILL_VERSION` |
7 | 7 | # - local file `.mill-version` |
8 | 8 | # - local file `.config/mill-version` |
9 | | -# - `mill-version` from YAML fronmatter of current buildfile |
| 9 | +# - `mill-version` from YAML frontmatter of current buildfile |
10 | 10 | # - if accessible, find the latest stable version available on Maven Central (https://repo1.maven.org/maven2) |
11 | 11 | # - env-variable `DEFAULT_MILL_VERSION` |
12 | 12 | # |
|
23 | 23 | # into a cache location (~/.cache/mill/download). |
24 | 24 | # |
25 | 25 | # Mill Project URL: https://github.com/com-lihaoyi/mill |
26 | | -# Script Version: 1.0.0-M1-49-ac90e3 |
| 26 | +# Script Version: 1.0.6 |
27 | 27 | # |
28 | 28 | # If you want to improve this script, please also contribute your changes back! |
29 | 29 | # This script was generated from: dist/scripts/src/mill.sh |
|
33 | 33 | set -e |
34 | 34 |
|
35 | 35 | if [ -z "${DEFAULT_MILL_VERSION}" ] ; then |
36 | | - DEFAULT_MILL_VERSION=0.12.14 |
| 36 | + DEFAULT_MILL_VERSION="1.0.6" |
37 | 37 | fi |
38 | 38 |
|
39 | 39 |
|
@@ -73,7 +73,19 @@ if [ -z "${MILL_VERSION}" ] ; then |
73 | 73 | elif [ -f ".config/mill-version" ] ; then |
74 | 74 | MILL_VERSION="$(tr '\r' '\n' < .config/mill-version | head -n 1 2> /dev/null)" |
75 | 75 | elif [ -n "${MILL_BUILD_SCRIPT}" ] ; then |
76 | | - MILL_VERSION="$(cat ${MILL_BUILD_SCRIPT} | grep '//[|] *mill-version: *' | sed 's;//| *mill-version: *;;')" |
| 76 | + # `s/.*://`: |
| 77 | + # This is a greedy match that removes everything from the beginning of the line up to (and including) the last |
| 78 | + # colon (:). This effectively isolates the value part of the declaration. |
| 79 | + # |
| 80 | + # `s/#.*//`: |
| 81 | + # This removes any comments at the end of the line. |
| 82 | + # |
| 83 | + # `s/['\"]//g`: |
| 84 | + # This removes all single and double quotes from the string, wherever they appear (g is for "global"). |
| 85 | + # |
| 86 | + # `s/^[[:space:]]*//; s/[[:space:]]*$//`: |
| 87 | + # These two expressions trim any leading or trailing whitespace ([[:space:]] matches spaces and tabs). |
| 88 | + MILL_VERSION="$(grep -E "//\|.*mill-version" "${MILL_BUILD_SCRIPT}" | sed -E "s/.*://; s/#.*//; s/['\"]//g; s/^[[:space:]]*//; s/[[:space:]]*$//")" |
77 | 89 | fi |
78 | 90 | fi |
79 | 91 |
|
@@ -309,7 +321,7 @@ if [ -z "$MILL_MAIN_CLI" ] ; then |
309 | 321 | fi |
310 | 322 |
|
311 | 323 | MILL_FIRST_ARG="" |
312 | | -if [ "$1" = "--bsp" ] || [ "$1" = "-i" ] || [ "$1" = "--interactive" ] || [ "$1" = "--no-server" ] || [ "$1" = "--repl" ] || [ "$1" = "--help" ] ; then |
| 324 | +if [ "$1" = "--bsp" ] || [ "${1#"-i"}" != "$1" ] || [ "$1" = "--interactive" ] || [ "$1" = "--no-server" ] || [ "$1" = "--no-daemon" ] || [ "$1" = "--repl" ] || [ "$1" = "--help" ] ; then |
313 | 325 | # Need to preserve the first position of those listed options |
314 | 326 | MILL_FIRST_ARG=$1 |
315 | 327 | shift |
|
0 commit comments