]> git.corax.cc Git - toolbox/commitdiff
include/opt: Make --verbose and --shush default arguments
authorMatthias Kruk <m@m10k.eu>
Thu, 15 Apr 2021 12:05:35 +0000 (21:05 +0900)
committerMatthias Kruk <m@m10k.eu>
Thu, 15 Apr 2021 12:05:35 +0000 (21:05 +0900)
The -v/--verbose and -w/--shush options are frequently implemented in
scripts that use toolbox. To reduce code duplication and to make all
scripts follow the same argument naming conventions, this commit makes
-v/--verbose and -w/--shush standard arguments of the opt module.

include/opt.sh

index 3c3c9a329f77ea556702dbade5f93294be2d3bbc..7af5be310900c60340571684a14a9fdc2a18ae29 100644 (file)
@@ -19,6 +19,13 @@ __init() {
                    "Print this text" \
                    opt_print_help
 
+       opt_add_arg "v" "verbose" "no" 0 \
+                   "Be more verbose" \
+                   log_increase_verbosity
+       opt_add_arg "w" "shush" "no" 0 \
+                   "Be less verbose" \
+                   log_decrease_verbosity
+
        return 0
 }