Skip to content

Commit 6edb195

Browse files
authored
Merge 746f55a into c77999b
2 parents c77999b + 746f55a commit 6edb195

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

install.sh

+14-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
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-}" ]; 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"
@@ -135,6 +142,7 @@ main() {
135142
OPTIONAL \
136143
ALL_FLAGS \
137144
RSH_ARGS \
145+
EDGE \
138146
RSH
139147

140148
ALL_FLAGS=""
@@ -170,6 +178,9 @@ main() {
170178
--version=*)
171179
VERSION="$(parse_arg "$@")"
172180
;;
181+
--edge)
182+
EDGE=1
183+
;;
173184
--rsh)
174185
RSH="$(parse_arg "$@")"
175186
shift

0 commit comments

Comments
 (0)