diff --git a/advanced/Scripts/blacklist.sh b/advanced/Scripts/blacklist.sh index 9e5d557b..fe6d42f3 100755 --- a/advanced/Scripts/blacklist.sh +++ b/advanced/Scripts/blacklist.sh @@ -11,16 +11,7 @@ # (at your option) any later version. if [[ $# = 0 ]]; then - echo "::: Immediately blacklists one or more domains in the hosts file" - echo ":::" - echo "::: Usage: sudo pihole.sh -b domain1 [domain2 ...]" - echo ":::" - echo "::: Options:" - echo "::: -d, --delmode Remove domains from the blacklist" - echo "::: -nr, --noreload Update blacklist without refreshing dnsmasq" - echo "::: -f, --force Force updating of the hosts files, even if there are no changes" - echo "::: -q, --quiet output is less verbose" - exit 1 + helpFunc fi #globals @@ -58,6 +49,21 @@ if [[ -f $piholeIPv6file ]];then fi +function helpFunc() +{ + echo "::: Immediately blacklists one or more domains in the hosts file" + echo ":::" + echo "::: Usage: sudo pihole.sh -b domain1 [domain2 ...]" + echo ":::" + echo "::: Options:" + echo "::: -d, --delmode Remove domains from the blacklist" + echo "::: -nr, --noreload Update blacklist without refreshing dnsmasq" + echo "::: -f, --force Force updating of the hosts files, even if there are no changes" + echo "::: -q, --quiet output is less verbose" + echo "::: -h, --help Show this help dialog" + exit 1 +} + function HandleOther(){ #check validity of domain validDomain=$(echo "$1" | perl -ne'print if /\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/') @@ -175,7 +181,8 @@ do "-nr"| "--noreload" ) reload=false;; "-d" | "--delmode" ) addmode=false;; "-f" | "--force" ) force=true;; - "-q" | "--quiet" ) versbose=false;; + "-q" | "--quiet" ) versbose=false;; + "-h" | "--help" ) helpFunc;; * ) HandleOther "$var";; esac done