forked from Shinonome/dots-hyprland
feat: update exp-update default-choice to use string flags
This commit is contained in:
@@ -15,11 +15,10 @@ Options:
|
|||||||
-h, --help Show this help message
|
-h, --help Show this help message
|
||||||
-s, --skip-notice Skip notice about script being untested
|
-s, --skip-notice Skip notice about script being untested
|
||||||
--non-interactive
|
--non-interactive
|
||||||
Run without prompting for user input
|
Set default choice for file conflicts (usually used with --non-interactive)
|
||||||
--default-choice=N
|
replace: Replace local keep: Keep local old: Backup as .old
|
||||||
Set default choice for file conflicts (1-8, used with --non-interactive)
|
new: Save as .new diff: Show diff skip: Skip
|
||||||
1=Replace local 2=Keep local 3=Backup as .old 4=Save as .new
|
ignore: Add to ignore backup: Backup and replace
|
||||||
5=Show diff 6=Skip 7=Add to ignore 8=Backup and replace
|
|
||||||
|
|
||||||
This script updates your dotfiles by:
|
This script updates your dotfiles by:
|
||||||
1. Auto-detecting repository structure (dots/ prefix or direct)
|
1. Auto-detecting repository structure (dots/ prefix or direct)
|
||||||
@@ -86,11 +85,23 @@ while true ; do
|
|||||||
--non-interactive) NON_INTERACTIVE=true;shift
|
--non-interactive) NON_INTERACTIVE=true;shift
|
||||||
log_info "Non-interactive mode enabled"
|
log_info "Non-interactive mode enabled"
|
||||||
;;
|
;;
|
||||||
--default-choice) DEFAULT_CHOICE="$2";shift 2
|
--default-choice)
|
||||||
if [[ ! "$DEFAULT_CHOICE" =~ ^[1-8]$ ]]; then
|
case "$2" in
|
||||||
log_error "Invalid --default-choice value: $DEFAULT_CHOICE (must be 1-8)"
|
replace) DEFAULT_CHOICE="1" ;;
|
||||||
exit 1
|
keep) DEFAULT_CHOICE="2" ;;
|
||||||
fi
|
old) DEFAULT_CHOICE="3" ;;
|
||||||
|
new) DEFAULT_CHOICE="4" ;;
|
||||||
|
diff) DEFAULT_CHOICE="5" ;;
|
||||||
|
skip) DEFAULT_CHOICE="6" ;;
|
||||||
|
ignore) DEFAULT_CHOICE="7" ;;
|
||||||
|
backup) DEFAULT_CHOICE="8" ;;
|
||||||
|
*)
|
||||||
|
log_error "Invalid --default-choice value: $2"
|
||||||
|
log_error "Valid values: replace, keep, old, new, diff, skip, ignore, backup"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift 2
|
||||||
log_info "Default conflict choice set to: $DEFAULT_CHOICE"
|
log_info "Default conflict choice set to: $DEFAULT_CHOICE"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user