Skip to content

Commit ecc2ecf

Browse files
committed
feat(upgrade): add option to skip all versions of a runtime
For multi-version tools (php, python, go, node, ruby), users can now: - Press 'p' to skip just this version (e.g., php@8.5) - Press 'P' to skip ALL versions of that runtime (e.g., all PHP) When 'P' is selected, the base tool (e.g., php.json) gets pinned to "never", which causes all multi-version variants to be skipped. This improves DX when users don't want a runtime at all - no need to skip each version individually.
1 parent e5703c8 commit ecc2ecf

1 file changed

Lines changed: 37 additions & 7 deletions

File tree

scripts/guide.sh

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,20 +253,34 @@ process_tool() {
253253
printf " n = Skip (ask again next time)\n"
254254
printf " s = Skip version %s (ask again if newer available)\n" "$latest"
255255
printf " p = Pin to %s (don't ask for upgrades)\n" "$installed"
256+
if [ -n "$is_multi_version" ]; then
257+
printf " P = Skip all %s versions (never install any)\n" "$catalog_tool"
258+
fi
256259
else
257260
printf " y = Install now\n"
258261
printf " a = Always update (install now + auto-update in future)\n"
259262
printf " N = Skip (default, ask again next time)\n"
260263
printf " s = Skip version %s (ask again if newer available)\n" "$latest"
261-
printf " p = Never install (permanently skip this tool)\n"
264+
printf " p = Never install (permanently skip this version)\n"
265+
if [ -n "$is_multi_version" ]; then
266+
printf " P = Skip all %s versions (never install any)\n" "$catalog_tool"
267+
fi
262268
fi
263269

264270
# Different defaults: Y for update, N for install
265271
local prompt_text
266272
if [ -n "$installed" ]; then
267-
prompt_text="Upgrade? [Y/a/n/s/p] "
273+
if [ -n "$is_multi_version" ]; then
274+
prompt_text="Upgrade? [Y/a/n/s/p/P] "
275+
else
276+
prompt_text="Upgrade? [Y/a/n/s/p] "
277+
fi
268278
else
269-
prompt_text="Install? [y/a/N/s/p] "
279+
if [ -n "$is_multi_version" ]; then
280+
prompt_text="Install? [y/a/N/s/p/P] "
281+
else
282+
prompt_text="Install? [y/a/N/s/p] "
283+
fi
270284
fi
271285

272286
local ans=""
@@ -390,13 +404,24 @@ process_tool() {
390404
printf " Skipping version %s (will prompt again if newer version available)\n" "$latest"
391405
"$ROOT"/scripts/pin_version.sh "$tool" "$latest" || true
392406
;;
393-
[Pp])
407+
[p])
394408
if [ -n "$installed" ]; then
395409
# Pin to current version
396410
printf " Pinning to current version %s\n" "$installed"
397411
"$ROOT"/scripts/pin_version.sh "$tool" "$installed" || true
398412
else
399-
# Never install - pin to "never"
413+
# Never install - pin to "never" for this specific version
414+
printf " Marking as 'never install' (permanently skip this version)\n"
415+
"$ROOT"/scripts/pin_version.sh "$tool" "never" || true
416+
fi
417+
;;
418+
[P])
419+
# Skip ALL versions of this runtime (only for multi-version tools)
420+
if [ -n "$is_multi_version" ]; then
421+
printf " Marking ALL %s versions as 'never install'\n" "$catalog_tool"
422+
"$ROOT"/scripts/pin_version.sh "$catalog_tool" "never" || true
423+
else
424+
# Fallback to regular pin for non-multi-version tools
400425
printf " Marking as 'never install' (permanently skip this tool)\n"
401426
"$ROOT"/scripts/pin_version.sh "$tool" "never" || true
402427
fi
@@ -456,14 +481,19 @@ while read -r line; do
456481
# Check if tool is pinned (use catalog name for pin check)
457482
pinned_version="$(catalog_get_property "$catalog_name" pinned_version)"
458483

459-
# For multi-version tools, check pinned_versions object
484+
# For multi-version tools, check pinned_versions object AND base tool pin
460485
if [ -n "$is_multi_version" ]; then
486+
# First check if the BASE tool (e.g., php) is pinned to "never" - skip ALL versions
487+
if [ "$pinned_version" = "never" ]; then
488+
continue
489+
fi
490+
# Then check version-specific pin
461491
version_cycle="${tool_name##*@}"
462492
multi_pin="$(catalog_get_pinned_version "$catalog_name" "$version_cycle")"
463493
if [ "$multi_pin" = "never" ]; then
464494
continue
465495
fi
466-
# Skip if this specific version cycle is pinned
496+
# Skip if this specific version cycle is pinned to a version
467497
if [ -n "$multi_pin" ]; then
468498
continue
469499
fi

0 commit comments

Comments
 (0)