@beplus/be 0.5.0 → 0.6.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.
Files changed (2) hide show
  1. package/bin/be +13 -9
  2. 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.5.0"
67
+ VERSION="v0.6.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
 
@@ -1135,8 +1140,9 @@ function display_remote_versions() {
1135
1140
  is_exact_numeric_version "${version}" && match_count=1
1136
1141
  # Quote any dots in version so they are literal for expression
1137
1142
  match="${version//\./\.}"
1138
- # Avoid 1.2 matching 1.23
1139
- match="^${match}[^0-9]"
1143
+ # Anchor the end so '1' matches v1.x but not v10.x, while an exact
1144
+ # 'v1.2.3' still matches its bare name (which has no trailing separator).
1145
+ match="^${match}([^0-9]|$)"
1140
1146
  else
1141
1147
  abort "invalid version '$1'"
1142
1148
  fi
@@ -1145,12 +1151,10 @@ function display_remote_versions() {
1145
1151
  # local index_url="https://beplus.s3.amazonaws.com/cli/releases.json"
1146
1152
  local index_url="${BE_RELEASE_INDEX_URL:-https://beplus.s3.amazonaws.com/cli/releases.json}"
1147
1153
 
1148
- for row in $(do_get_index "${index_url}" | jq -r '.[] | @base64'); do
1149
- _jq() {
1150
- echo ${row} | base64 --decode | jq -r ${1}
1151
- }
1152
- echo $(_jq '.name')
1153
- done | awk "NR<=${match_count}" \
1154
+ do_get_index "${index_url}" \
1155
+ | jq -r '.[] | .name' \
1156
+ | n_grep -E "${match}" \
1157
+ | awk "NR<=${match_count}" \
1154
1158
  | cut -f 1 \
1155
1159
  | n_grep -E -o '[^v].*'
1156
1160
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@beplus/be",
3
3
  "description": "Interactively Manage beplus CLI Versions",
4
- "version": "0.5.0",
4
+ "version": "0.6.0",
5
5
  "author": "Igor Lamos <igor@be.plus>",
6
6
  "homepage": "https://github.com/beplus/be",
7
7
  "bugs": "https://github.com/beplus/be",