mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Use heredocs instead of multiple calls to echo
There were a lot of places (like in help functions) that used multiple echo calls instead of heredocs. Personal opinion but this seems cleaner.
This commit is contained in:
parent
28eeaf201b
commit
0efda04920
6 changed files with 68 additions and 57 deletions
|
@ -11,17 +11,19 @@
|
|||
# (at your option) any later version.
|
||||
|
||||
helpFunc() {
|
||||
echo "::: Immediately blacklists one or more domains in the hosts file"
|
||||
echo ":::"
|
||||
echo ":::"
|
||||
echo "::: Usage: pihole -b domain1 [domain2 ...]"
|
||||
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"
|
||||
echo "::: -l, --list Display your blacklisted domains"
|
||||
cat << EOM
|
||||
::: Immediately blacklists one or more domains in the hosts file
|
||||
:::
|
||||
:::
|
||||
::: Usage: pihole -b domain1 [domain2 ...]
|
||||
::: Options:
|
||||
::: -d, --delmode Remove domains from the blacklist
|
||||
::: -nr, --noreload Update blacklist without refreshing dnsmasq
|
||||
::: -f, --force Force updating of the hosts files, even if there are no changes
|
||||
::: -q, --quiet output is less verbose
|
||||
::: -h, --help Show this help dialog
|
||||
::: -l, --list Display your blacklisted domains
|
||||
EOM
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
|
|
@ -122,15 +122,16 @@ normalChrono() {
|
|||
}
|
||||
|
||||
displayHelp() {
|
||||
echo "::: Displays stats about your piHole!"
|
||||
echo ":::"
|
||||
echo "::: Usage: sudo pihole -c [optional:-j]"
|
||||
echo "::: Note: If no option is passed, then stats are displayed on screen, updated every 5 seconds"
|
||||
echo ":::"
|
||||
echo "::: Options:"
|
||||
echo "::: -j, --json output stats as JSON formatted string"
|
||||
echo "::: -h, --help display this help text"
|
||||
|
||||
cat << EOM
|
||||
::: Displays stats about your piHole!
|
||||
:::
|
||||
::: Usage: sudo pihole -c [optional:-j]
|
||||
::: Note: If no option is passed, then stats are displayed on screen, updated every 5 seconds
|
||||
:::
|
||||
::: Options:
|
||||
::: -j, --json output stats as JSON formatted string
|
||||
::: -h, --help display this help text
|
||||
EOM
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
|
|
@ -27,12 +27,14 @@ PIHOLELOG="/var/log/pihole.log"
|
|||
WHITELISTMATCHES="/tmp/whitelistmatches.list"
|
||||
|
||||
# Header info and introduction
|
||||
echo "::: Beginning Pi-hole debug at $(date)!"
|
||||
echo "::: This debugging process will collect information from your running configuration,"
|
||||
echo "::: and optionally upload the generated log to a unique and random directory on"
|
||||
echo "::: Termbin.com. NOTE: All log files auto-delete after 1 month and you are the only"
|
||||
echo "::: person who is given the unique URL. Please consider where you post this link."
|
||||
echo "::: "
|
||||
cat << EOM
|
||||
::: Beginning Pi-hole debug at $(date)!
|
||||
::: This debugging process will collect information from your running configuration,
|
||||
::: and optionally upload the generated log to a unique and random directory on
|
||||
::: Termbin.com. NOTE: All log files auto-delete after 1 month and you are the only
|
||||
::: person who is given the unique URL. Please consider where you post this link.
|
||||
:::
|
||||
EOM
|
||||
|
||||
|
||||
######## FIRST CHECK ########
|
||||
|
|
|
@ -72,19 +72,21 @@ coreOutput() {
|
|||
}
|
||||
|
||||
helpFunc() {
|
||||
echo ":::"
|
||||
echo "::: Show Pi-hole/Web Admin versions"
|
||||
echo ":::"
|
||||
echo "::: Usage: pihole -v [ -a | -p ] [ -l | -c ]"
|
||||
echo ":::"
|
||||
echo "::: Options:"
|
||||
echo "::: -a, --admin Show both current and latest versions of web admin"
|
||||
echo "::: -p, --pihole Show both current and latest versions of Pi-hole core files"
|
||||
echo "::: -l, --latest (Only after -a | -p) Return only latest version"
|
||||
echo "::: -c, --current (Only after -a | -p) Return only current version"
|
||||
echo "::: -h, --help Show this help dialog"
|
||||
echo ":::"
|
||||
exit 0
|
||||
cat << EOM
|
||||
:::
|
||||
::: Show Pi-hole/Web Admin versions
|
||||
:::
|
||||
::: Usage: pihole -v [ -a | -p ] [ -l | -c ]
|
||||
:::
|
||||
::: Options:
|
||||
::: -a, --admin Show both current and latest versions of web admin
|
||||
::: -p, --pihole Show both current and latest versions of Pi-hole core files
|
||||
::: -l, --latest (Only after -a | -p) Return only latest version
|
||||
::: -c, --current (Only after -a | -p) Return only current version
|
||||
::: -h, --help Show this help dialog
|
||||
:::
|
||||
EOM
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [[ $# = 0 ]]; then
|
||||
|
|
|
@ -12,17 +12,19 @@
|
|||
|
||||
|
||||
helpFunc() {
|
||||
echo "::: Immediately whitelists one or more domains in the hosts file"
|
||||
echo ":::"
|
||||
echo "::: Usage: pihole -w domain1 [domain2 ...]"
|
||||
echo ":::"
|
||||
echo "::: Options:"
|
||||
echo "::: -d, --delmode Remove domains from the whitelist"
|
||||
echo "::: -nr, --noreload Update Whitelist 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"
|
||||
echo "::: -l, --list Display your whitelisted domains"
|
||||
cat << EOM
|
||||
::: Immediately whitelists one or more domains in the hosts file
|
||||
:::
|
||||
::: Usage: pihole -w domain1 [domain2 ...]
|
||||
:::
|
||||
::: Options:
|
||||
::: -d, --delmode Remove domains from the whitelist
|
||||
::: -nr, --noreload Update Whitelist without refreshing dnsmasq
|
||||
::: -f, --force Force updating of the hosts files, even if there are no changes
|
||||
::: -q, --quiet output is less verbose
|
||||
::: -h, --help Show this help dialog
|
||||
::: -l, --list Display your whitelisted domains
|
||||
EOM
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
|
16
gravity.sh
16
gravity.sh
|
@ -14,13 +14,15 @@
|
|||
echo ":::"
|
||||
|
||||
helpFunc() {
|
||||
echo "::: Pull in domains from adlists"
|
||||
echo ":::"
|
||||
echo "::: Usage: pihole -g"
|
||||
echo ":::"
|
||||
echo "::: Options:"
|
||||
echo "::: -f, --force Force lists to be downloaded, even if they don't need updating."
|
||||
echo "::: -h, --help Show this help dialog"
|
||||
cat << EOM
|
||||
::: Pull in domains from adlists
|
||||
:::
|
||||
::: Usage: pihole -g
|
||||
:::
|
||||
::: Options:
|
||||
::: -f, --force Force lists to be downloaded, even if they don't need updating.
|
||||
::: -h, --help Show this help dialog
|
||||
EOM
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue