install: add -y option
This commit is contained in:
parent
69f142aed8
commit
880edd13ff
1 changed files with 7 additions and 3 deletions
10
install.sh
10
install.sh
|
@ -48,9 +48,9 @@ greeting() {
|
||||||
echo " Source: $cyan$dotfiles$sgr0"
|
echo " Source: $cyan$dotfiles$sgr0"
|
||||||
echo " Destination: $cyan$DESTDIR$sgr0"
|
echo " Destination: $cyan$DESTDIR$sgr0"
|
||||||
echo " Git user: $green$GIT_USER <$GIT_EMAIL>$sgr0"
|
echo " Git user: $green$GIT_USER <$GIT_EMAIL>$sgr0"
|
||||||
|
|
||||||
if [ -t 0 ] && [ -t 1 ]; then
|
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
if [ -t 0 ] && [ -t 1 ] && [ "$SKIP_CONFIRMATION" != "yes" ] ; then
|
||||||
echo "Press ENTER to continue (CTRL-C to cancel)..."
|
echo "Press ENTER to continue (CTRL-C to cancel)..."
|
||||||
read -r _
|
read -r _
|
||||||
fi
|
fi
|
||||||
|
@ -108,6 +108,7 @@ usage() {
|
||||||
echo ""
|
echo ""
|
||||||
echo " -h print this help and exit"
|
echo " -h print this help and exit"
|
||||||
echo " -n perform dry run"
|
echo " -n perform dry run"
|
||||||
|
echo " -y assume yes, i.e. don't ask for confirmation"
|
||||||
}
|
}
|
||||||
|
|
||||||
execute() {
|
execute() {
|
||||||
|
@ -140,13 +141,16 @@ execute() {
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
while getopts 'hn' opt; do
|
while getopts 'hny' opt; do
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
n) # dry run
|
n) # dry run
|
||||||
cmd=echo
|
cmd=echo
|
||||||
echo "${yellow}Performing dry run (no changes will be made).${sgr0}"
|
echo "${yellow}Performing dry run (no changes will be made).${sgr0}"
|
||||||
echo
|
echo
|
||||||
;;
|
;;
|
||||||
|
y) # assume yes, i.e. skip confirmation
|
||||||
|
SKIP_CONFIRMATION='yes'
|
||||||
|
;;
|
||||||
h) # help
|
h) # help
|
||||||
usage
|
usage
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Add table
Reference in a new issue