fix(updater): treat a flag in the version slot as a flag
`updater upgrade <app> --detach` parsed "--detach" as the target version and refused with "no safe path from 31-fpm-alpine to --detach". It failed safe, but blaming the version for a misplaced flag is a poor way to say the flag is not supported here. Unknown options now say so. Found during the first live ladder run. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
6b44b7dd59
commit
98b7f7dd39
@ -102,7 +102,15 @@ cliHandleUpdaterCommands()
|
||||
# latter needs a ladder, a verifier and a snapshot per step.
|
||||
if [[ -z "$app" ]]; then isError "Usage: libreportal updater upgrade <app> [version] [--dry-run]"; return 1; fi
|
||||
local upgrade_target="$initial_command4" upgrade_mode="$initial_command5"
|
||||
[[ "$upgrade_target" == "--dry-run" ]] && { upgrade_mode="--dry-run"; upgrade_target=""; }
|
||||
# Any flag in the version slot is a flag, not a version. Without
|
||||
# this, `upgrade <app> --detach` treated "--detach" as the target
|
||||
# and refused with "no safe path to --detach" — it failed safe, but
|
||||
# blaming the version for a misplaced flag is a poor way to say
|
||||
# "that flag isn't supported here".
|
||||
case "$upgrade_target" in
|
||||
--dry-run) upgrade_mode="--dry-run"; upgrade_target="" ;;
|
||||
--*) isError "Unknown option '$upgrade_target'. Usage: libreportal updater upgrade <app> [version] [--dry-run]"; return 1 ;;
|
||||
esac
|
||||
for _f in cli_updater_ladder cli_updater_verify cli_updater_upgrade; do
|
||||
declare -F updaterUpgradeApp >/dev/null 2>&1 || \
|
||||
source "$install_scripts_dir/cli/commands/updater/${_f}.sh" 2>/dev/null
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user