install: add -y option

This commit is contained in:
Fernando Schauenburg 2023-07-07 22:29:51 +02:00
parent 69f142aed8
commit 880edd13ff

View file

@ -48,9 +48,9 @@ greeting() {
echo " Source: $cyan$dotfiles$sgr0"
echo " Destination: $cyan$DESTDIR$sgr0"
echo " Git user: $green$GIT_USER <$GIT_EMAIL>$sgr0"
if [ -t 0 ] && [ -t 1 ]; then
echo
if [ -t 0 ] && [ -t 1 ] && [ "$SKIP_CONFIRMATION" != "yes" ] ; then
echo "Press ENTER to continue (CTRL-C to cancel)..."
read -r _
fi
@ -108,6 +108,7 @@ usage() {
echo ""
echo " -h print this help and exit"
echo " -n perform dry run"
echo " -y assume yes, i.e. don't ask for confirmation"
}
execute() {
@ -140,13 +141,16 @@ execute() {
}
main() {
while getopts 'hn' opt; do
while getopts 'hny' opt; do
case "$opt" in
n) # dry run
cmd=echo
echo "${yellow}Performing dry run (no changes will be made).${sgr0}"
echo
;;
y) # assume yes, i.e. skip confirmation
SKIP_CONFIRMATION='yes'
;;
h) # help
usage
exit 0