one section per concern, each announced and confirmed before it acts
Three sections where there were two, and none of them touches the machine until you say so: 2. System update upgrades what is already installed 3. Core utils what the distribution provides 4. Command-line tools lazydocker, lazygit, starship, fastfetch The split matters because these are different kinds of change and deserve separate answers. System update is the only step in the whole script that moves versions of software already on the machine; core utils only ever adds what is absent; and the four tools are upstream binaries the distribution does not ship at all. Previously the update and the core packages were one step and the tools were tacked onto the end of it, so agreeing to "essentials" meant agreeing to all three at once. Every section now prints what it will install and what it is leaving alone, then asks. Enter means yes — unlike the machine-role question, which has no default, because these are "do the thing you already asked for" and making twenty of them require a deliberate keystroke would train people to hold the y key down. ASSUME_YES=1 answers all of them for an unattended run, and EOF fails with that named rather than spinning. Refusing is recorded rather than glossed: LAST_SKIPPED feeds the summary, so a declined section reads "Core utils: SKIPPED by request — cowsay neofetch" instead of quietly reporting nothing installed. Nothing to install means no prompt at all — there is nothing to agree to. announce_plan takes the array NAMES rather than their contents, because once a list has been through word splitting an empty one cannot be told from a missing one. Verified all three paths: accept, refuse, and nothing-to-do. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -109,6 +109,7 @@ tools_install() {
|
||||
|
||||
local tool
|
||||
local -a missing=() present=()
|
||||
LAST_SKIPPED=()
|
||||
for tool in "$@"; do
|
||||
if tool_is_installed "$tool"; then present+=("$tool"); else missing+=("$tool"); fi
|
||||
done
|
||||
@@ -116,15 +117,8 @@ tools_install() {
|
||||
LAST_INSTALLED=("${missing[@]}")
|
||||
LAST_KEPT=("${present[@]}")
|
||||
|
||||
info "$label — installs what is missing, keeps what you already have"
|
||||
((${#present[@]})) && echo " already here: ${present[*]}"
|
||||
announce_plan "$label" present missing || return 0
|
||||
|
||||
if ((${#missing[@]} == 0)); then
|
||||
echo " to install: nothing, all present"
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo " to install: ${missing[*]}"
|
||||
for tool in "${missing[@]}"; do
|
||||
info " installing ${tool}..."
|
||||
"tool_install_${tool}"
|
||||
|
||||
Reference in New Issue
Block a user