feat(update): persist interactive install choices
This commit is contained in:
1 parent
80e1ab440e
commit
9a2a606410
14 files changed
+557
-82
No files matched your search
+19
-12
@@ -3,14 +3,14 @@ set -euo pipefail
|
||||
|
||||
dry_run=false
|
||||
client=""
|
||||
platform=""
|
||||
shell=""
|
||||
summary=false
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--dry-run) dry_run=true; shift ;;
|
||||
--summary) summary=true; shift ;;
|
||||
--client) client=${2:?--client requires a value}; shift 2 ;;
|
||||
--platform) platform=${2:?--platform requires a value}; shift 2 ;;
|
||||
--shell) shell=${2:?--shell requires a value}; shift 2 ;;
|
||||
*) printf 'Unknown argument: %s\n' "$1" >&2; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
@@ -20,8 +20,9 @@ root=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)
|
||||
. "$root/scripts/lib/manifest.sh"
|
||||
. "$root/scripts/lib/install-targets.sh"
|
||||
. "$root/scripts/lib/selection-state.sh"
|
||||
. "$root/scripts/lib/install-options.sh"
|
||||
|
||||
platform=$(read_install_platform "$platform")
|
||||
shell=$(read_install_shell "$shell")
|
||||
client=$(read_install_client "$client")
|
||||
|
||||
home_path=${HOME:?HOME is required}
|
||||
@@ -33,6 +34,8 @@ if [ "$dry_run" = false ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
read_install_options
|
||||
|
||||
build_args=()
|
||||
[ "$summary" = false ] || build_args+=(--summary)
|
||||
bash "$root/scripts/build.sh" "${build_args[@]}"
|
||||
@@ -40,23 +43,27 @@ generated="$root/generated"
|
||||
[ -d "$generated" ] || { printf 'Generated output is missing after a successful build.\n' >&2; exit 1; }
|
||||
|
||||
stamp=$(date +%Y%m%d-%H%M%S)
|
||||
powershell_command='pwsh -NoProfile -ExecutionPolicy Bypass -File'
|
||||
if command -v powershell >/dev/null; then powershell_command='powershell -NoProfile -ExecutionPolicy Bypass -File'; fi
|
||||
shell_command=bash
|
||||
windows_shell_command='powershell -NoProfile -ExecutionPolicy Bypass -File'
|
||||
|
||||
while IFS='|' read -r source destination; do
|
||||
ai_config_root=$destination
|
||||
command -v cygpath >/dev/null && ai_config_root=$(cygpath -m "$destination")
|
||||
sync_managed_destination "$source" "$destination" "$stamp" "$ai_config_root" "$shell_command" "$windows_shell_command" "$dry_run" "$summary"
|
||||
done < <(get_install_targets "$generated" "$home_path" "$platform" "$client")
|
||||
[ "$shell" != powershell ] || shell_command=$powershell_command
|
||||
|
||||
selected_plugins=()
|
||||
deselected_plugins=()
|
||||
select_configured_plugins "$root" "$client" Install "$dry_run" selected_plugins deselected_plugins
|
||||
install_configured_plugins "$root" "$client" "$dry_run" false selected_plugins "$summary"
|
||||
[ "$update_agents" = false ] || update_selected_agent_clis
|
||||
|
||||
while IFS='|' read -r source destination; do
|
||||
ai_config_root=$destination
|
||||
command -v cygpath >/dev/null && ai_config_root=$(cygpath -m "$destination")
|
||||
sync_managed_destination "$source" "$destination" "$stamp" "$ai_config_root" "$shell_command" "$powershell_command" "$dry_run" "$summary" "$flashbang"
|
||||
done < <(get_install_targets "$generated" "$home_path" "$shell" "$client")
|
||||
|
||||
sync_configured_plugins "$root" "$client" "$home_path" "$dry_run" false selected_plugins "$summary"
|
||||
if [ "$dry_run" = false ]; then save_update_selection; fi
|
||||
|
||||
if [ "$summary" = true ]; then
|
||||
suffix=
|
||||
[ "$dry_run" = false ] || suffix=', dry-run'
|
||||
printf 'Install: PASS | %s, %s%s\n' "$client" "$platform" "$suffix"
|
||||
printf 'Install: PASS | %s, %s%s\n' "$client" "$shell" "$suffix"
|
||||
elif "$dry_run"; then printf 'PASS install dry-run\n'; else printf 'PASS install\n'; fi
|
||||
Reference in new issue
Block a user