@beplus/be 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/be +27 -9
- package/package.json +1 -1
package/bin/be
CHANGED
|
@@ -64,7 +64,7 @@ function n_grep() {
|
|
|
64
64
|
# Setup and state
|
|
65
65
|
#
|
|
66
66
|
|
|
67
|
-
VERSION="v0.
|
|
67
|
+
VERSION="v0.7.0"
|
|
68
68
|
|
|
69
69
|
BE_PREFIX="${BE_PREFIX-/usr/local}"
|
|
70
70
|
BE_PREFIX=${BE_PREFIX%/}
|
|
@@ -1082,7 +1082,12 @@ function get_latest_resolved_version() {
|
|
|
1082
1082
|
g_target_beplus="${simple_version}"
|
|
1083
1083
|
else
|
|
1084
1084
|
# Complicated recognising exact version, KISS and lookup.
|
|
1085
|
+
# display_remote_versions lists newest first and may return several matches
|
|
1086
|
+
# (e.g. 'be 1' -> every 1.x); keep the newest as the single install target.
|
|
1085
1087
|
g_target_beplus=$(display_remote_versions "$version")
|
|
1088
|
+
local status=$?
|
|
1089
|
+
g_target_beplus="${g_target_beplus%%$'\n'*}"
|
|
1090
|
+
return "${status}"
|
|
1086
1091
|
fi
|
|
1087
1092
|
}
|
|
1088
1093
|
|
|
@@ -1111,6 +1116,9 @@ function display_remote_versions() {
|
|
|
1111
1116
|
local version="$1"
|
|
1112
1117
|
local match='.'
|
|
1113
1118
|
local match_count="${BE_MAX_REMOTE_MATCHES}"
|
|
1119
|
+
# Restrict to official releases (skip pre-releases and drafts) for the
|
|
1120
|
+
# 'latest'/'current'/'stable' labels.
|
|
1121
|
+
local official_only=
|
|
1114
1122
|
|
|
1115
1123
|
# Transform some labels before processing further.
|
|
1116
1124
|
if is_beplus_support_version "${version}"; then
|
|
@@ -1126,17 +1134,20 @@ function display_remote_versions() {
|
|
|
1126
1134
|
elif [[ "${version}" = "stable" ]]; then
|
|
1127
1135
|
match_count=1
|
|
1128
1136
|
match='.'
|
|
1137
|
+
official_only=1
|
|
1129
1138
|
elif [[ "${version}" = "latest" || "${version}" = "current" ]]; then
|
|
1130
1139
|
match_count=1
|
|
1131
1140
|
match='.'
|
|
1141
|
+
official_only=1
|
|
1132
1142
|
elif is_numeric_version "${version}"; then
|
|
1133
1143
|
version="v${version#v}"
|
|
1134
1144
|
# Avoid restriction message if exact version
|
|
1135
1145
|
is_exact_numeric_version "${version}" && match_count=1
|
|
1136
1146
|
# Quote any dots in version so they are literal for expression
|
|
1137
1147
|
match="${version//\./\.}"
|
|
1138
|
-
#
|
|
1139
|
-
|
|
1148
|
+
# Anchor the end so '1' matches v1.x but not v10.x, while an exact
|
|
1149
|
+
# 'v1.2.3' still matches its bare name (which has no trailing separator).
|
|
1150
|
+
match="^${match}([^0-9]|$)"
|
|
1140
1151
|
else
|
|
1141
1152
|
abort "invalid version '$1'"
|
|
1142
1153
|
fi
|
|
@@ -1145,12 +1156,19 @@ function display_remote_versions() {
|
|
|
1145
1156
|
# local index_url="https://beplus.s3.amazonaws.com/cli/releases.json"
|
|
1146
1157
|
local index_url="${BE_RELEASE_INDEX_URL:-https://beplus.s3.amazonaws.com/cli/releases.json}"
|
|
1147
1158
|
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1159
|
+
# Select the release names to consider. GitHub lists the newest release
|
|
1160
|
+
# first, including any in-progress pre-releases (e.g. a v2 published while v1
|
|
1161
|
+
# is still the current release), so 'latest'/'current'/'stable' filter those
|
|
1162
|
+
# out to resolve to the newest official release.
|
|
1163
|
+
local jq_release_filter='.[]'
|
|
1164
|
+
if [[ -n "${official_only}" ]]; then
|
|
1165
|
+
jq_release_filter='.[] | select(.prerelease != true and .draft != true)'
|
|
1166
|
+
fi
|
|
1167
|
+
|
|
1168
|
+
do_get_index "${index_url}" \
|
|
1169
|
+
| jq -r "${jq_release_filter} | .name" \
|
|
1170
|
+
| n_grep -E "${match}" \
|
|
1171
|
+
| awk "NR<=${match_count}" \
|
|
1154
1172
|
| cut -f 1 \
|
|
1155
1173
|
| n_grep -E -o '[^v].*'
|
|
1156
1174
|
|
package/package.json
CHANGED