Skip to content

Commit 15ab85e

Browse files
committed
feat: enable version refreshing when calling list by default
1 parent af435d3 commit 15ab85e

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
## Master
44

5+
### Enhancements
6+
7+
- Fetching a list of versions that can be installed (`swiftenv install --list`)
8+
will now fetch an updated list of versions.
9+
510
### Bug Fixes
611

712
- Prevent `swiftenv install` picking up on unrelated `$URL` environment

docs/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ $ swiftenv install 3.0
2626
You can list all versions of Swift:
2727

2828
```shell
29-
$ swiftenv install --list --refresh
29+
$ swiftenv install --list
3030
```
3131

3232
You can also list all binary snapshots of Swift that you can install.

libexec/swiftenv-install

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ get_version_list() {
251251
CACHE_FILE="$CACHE_DIR/versions-${platform}.txt"
252252

253253
if $refresh; then
254+
vlog "Updating version cache"
254255
# FIXME: Add support for architecture to swiftenv api
255256
mkdir -p $CACHE_DIR
256257
curl -s -H 'Accept: text/plain' "https://swiftenv-api.fuller.li/versions?platform=$platform" > "$CACHE_FILE"
@@ -267,7 +268,7 @@ get_version_list() {
267268

268269
clean=true
269270
list=false
270-
refresh=false
271+
refresh=true
271272
snapshots=false
272273
build=auto
273274
verbose=false
@@ -302,6 +303,7 @@ for args in "$@"; do
302303
elif [ "$args" = "--no-refresh" ]; then
303304
refresh=false
304305
elif [ "$args" = "--complete" ]; then
306+
refresh=false
305307
completes=true
306308
elif [ "$args" = "--build" ]; then
307309
build=true
@@ -345,6 +347,8 @@ vlog() {
345347
if $completes; then
346348
echo "--list"
347349
echo "--list-snapshots"
350+
echo "--refresh"
351+
echo "--no-refresh"
348352
echo "--verbose"
349353
echo "--no-verbose"
350354
echo "--verify"

share/man/man1/swiftenv-install.1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
swiftenv-install \- Install a version of Swift
55

66
.SH SYNOPSIS
7-
swiftenv install [\-\-verbose] [\-\-list] [\-\-list-snapshots] [\-\-[no\-]build] [\-\-[no\-]set\-global] [\-\-[no\-]set\-local] [--no-clean] [\-\-[no\-]user] <version>
7+
swiftenv install [\-\-verbose] [\-\-list] [\-\-list-snapshots] [\-\-no\-refresh] [\-\-[no\-]build] [\-\-[no\-]set\-global] [\-\-[no\-]set\-local] [--no-clean] [\-\-[no\-]user] <version>
88

99
.SH DESCRIPTION
1010

@@ -27,9 +27,16 @@ Lists all the Swift releases that can be installed.
2727
\-\-refresh
2828

2929
.RS
30+
On by default.
3031
When used in conjunction with \-\-list, fetches an updated information.
3132
.RE
3233

34+
\-\-no\-refresh
35+
36+
.RS
37+
Force using local version information with \-\-list.
38+
.RE
39+
3340
\-\-list-snapshots
3441

3542
.RS

0 commit comments

Comments
 (0)