diff --git a/t.sh b/t.sh index d961656..029ecac 100755 --- a/t.sh +++ b/t.sh @@ -58,6 +58,7 @@ function usage() { echo "usage: $0 COMMAND [OPTIONS] [commandopts]" echo echo " -s Auto-sync with server when complete." + echo " -f Assume 'yes' to all questions." echo printf "$format" "COMMAND" "DESCRIPTION" "SYNONYMS" for x in $valid_modes; do @@ -250,11 +251,15 @@ function error() { } function info() { + [[ $AUTOYES -eq 1 ]] && return echo -e "$BOLD${CYAN}>> $PLAIN$CYAN$*$PLAIN" } function confirm() { local yn + if [[ $AUTOYES -eq 1 ]]; then + return 0 + fi echo -en "$BOLD${MAGENTA}CONFIRM: $PLAIN$MAGENTA$* (y/N)? $PLAIN" read yn if [[ $yn == "y" ]]; then @@ -1178,8 +1183,7 @@ DEBUG=0 TESTMODE=0 AUTOSYNC=0 - -ARGS="hdst" +ARGS="fhdsty" while getopts "$ARGS" i; do case "$i" in h) @@ -1196,6 +1200,9 @@ while getopts "$ARGS" i; do DEBUG=1 TESTMODE=1 ;; + y|f) + AUTOYES=1 + ;; *) error "invalid argument: $i"; usage;