Skip to content

Commit 385be36

Browse files
committed
adding option --edge to install latest edge / preview version
1 parent c77999b commit 385be36

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

install.sh

+17-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The remote host must have internet access.
2323
${not_curl_usage-}
2424
Usage:
2525
26-
$arg0 [--dry-run] [--version X.X.X] [--method detect] \
26+
$arg0 [--dry-run] [--version X.X.X] [--edge] [--method detect] \
2727
[--prefix ~/.local] [--rsh ssh] [user@host]
2828
2929
--dry-run
@@ -32,6 +32,9 @@ Usage:
3232
--version X.X.X
3333
Install a specific version instead of the latest.
3434
35+
--edge [true | false (default) ]
36+
Install the latest edge version instead of the latest stable version.
37+
3538
--method [detect | standalone]
3639
Choose the installation method. Defaults to detect.
3740
- detect detects the system package manager and tries to use it.
@@ -71,8 +74,12 @@ EOF
7174
}
7275

7376
echo_latest_version() {
74-
# https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c#gistcomment-2758860
75-
version="$(curl -fsSLI -o /dev/null -w "%{url_effective}" https://github.com/cdr/code-server/releases/latest)"
77+
if [ "${EDGE:-false}" = "true" ]; then
78+
version="$(curl -fsSL https://api.github.com/repos/cdr/code-server/releases | awk 'match($0,/.*"html_url": "(.*\/releases\/tag\/.*)".*/)' | head -n 1 | awk -F '"' '{print $4}')"
79+
else
80+
# https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c#gistcomment-2758860
81+
version="$(curl -fsSLI -o /dev/null -w "%{url_effective}" https://github.com/cdr/code-server/releases/latest)"
82+
fi
7683
version="${version#https://github.com/cdr/code-server/releases/tag/}"
7784
version="${version#v}"
7885
echo "$version"
@@ -170,6 +177,13 @@ main() {
170177
--version=*)
171178
VERSION="$(parse_arg "$@")"
172179
;;
180+
--edge)
181+
EDGE="$(parse_arg "$@")"
182+
shift
183+
;;
184+
--edge=*)
185+
EDGE="$(parse_arg "$@")"
186+
;;
173187
--rsh)
174188
RSH="$(parse_arg "$@")"
175189
shift

0 commit comments

Comments
 (0)