Add backup option

This commit is contained in:
Emanuele Petriglia 2018-06-16 11:54:08 +02:00
parent d215dea5b0
commit 6b2c30b7cc
No known key found for this signature in database
GPG Key ID: CD2F70AE16A43647

View File

@ -14,14 +14,14 @@
#
# Report bugs to https://github.com/ghacksuserjs/ghacks-user.js/issues
readonly VERSION="1.4"
readonly VERSION="2.0"
# Default values for flags.
QUIET="false"
VERBOSE="false"
FORCE_VERSION="false"
UPDATED="false"
MAKE_BACKUP="false"
# Prints a message to the standard error and exit with error code 1.
error() {
@ -68,12 +68,13 @@ show_help() {
cat <<-_EOF
Usage:
$PROGRAM [--update,-u] [--verbose] [--quiet,-q] [--force-version,-f]
[--help,-h] [--version,-v]
[--help,-h] [--version,-v] [--backup,-b]
Options:
-u, --update First updates the updater script, then the user.js
--force-version, -f Force to download the user.js according to the
Firefox version
--backup, -b Make a copy of the old user.js before overwriting it
--quiet, -q Print only errors
--verbose Print additional informations
--help Print this message
@ -128,6 +129,7 @@ while :; do
--verbose) shift; VERBOSE="true";;
--help|-h) shift; SHOW_HELP="true";;
--version|-v) shift; SHOW_VERSION="true";;
--backup|-b) shift; MAKE_BACKUP="true";;
"") break;; # Default case: no more options.
*) error "Unrecognized option '$1'";;
esac