fix: update usage instructions to support optional group argument in package installation scripts
This commit is contained in:
@@ -3,12 +3,14 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Usage: $0 <dotfiles_directory>"
|
||||
if [ $# -lt 1 ] || [ $# -gt 2 ]; then
|
||||
echo "Usage: $0 <dotfiles_directory> [group]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dotfiles_dir="$1"
|
||||
# Optional group argument (e.g., base.txt)
|
||||
group_arg="${2:-}"
|
||||
# Source shared utilities
|
||||
source "$dotfiles_dir/scripts/utils.sh"
|
||||
|
||||
@@ -101,8 +103,15 @@ install_package_lists() {
|
||||
|
||||
# Determine which groups to install
|
||||
local selected_groups=()
|
||||
# Determine interactive mode: forced via INTERACTIVE=1 or a real interactive shell
|
||||
if [ "${INTERACTIVE:-0}" -eq 1 ] || is_interactive; then
|
||||
if [ -n "$group_arg" ]; then
|
||||
# Direct install of specified group
|
||||
if [[ " ${package_files[*]} " == *" $group_arg"* ]]; then
|
||||
selected_groups=("$group_arg")
|
||||
else
|
||||
log_error "Unknown package group: $group_arg"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Available package groups:"
|
||||
for pkg in "${package_files[@]}"; do
|
||||
if [ -f "$packages_dir/$pkg" ]; then
|
||||
@@ -123,9 +132,6 @@ install_package_lists() {
|
||||
fi
|
||||
done
|
||||
fi
|
||||
else
|
||||
# Non-interactive: install only the base group
|
||||
selected_groups=("base.txt")
|
||||
fi
|
||||
|
||||
# Loop through selected package lists
|
||||
|
||||
Reference in New Issue
Block a user