1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-22 23:08:07 +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:
Marcus Hildum 2016-10-19 20:46:37 -07:00
parent 28eeaf201b
commit 0efda04920
6 changed files with 68 additions and 57 deletions

View File

@ -11,17 +11,19 @@
# (at your option) any later version. # (at your option) any later version.
helpFunc() { helpFunc() {
echo "::: Immediately blacklists one or more domains in the hosts file" cat << EOM
echo ":::" ::: Immediately blacklists one or more domains in the hosts file
echo ":::" :::
echo "::: Usage: pihole -b domain1 [domain2 ...]" :::
echo "::: Options:" ::: Usage: pihole -b domain1 [domain2 ...]
echo "::: -d, --delmode Remove domains from the blacklist" ::: Options:
echo "::: -nr, --noreload Update blacklist without refreshing dnsmasq" ::: -d, --delmode Remove domains from the blacklist
echo "::: -f, --force Force updating of the hosts files, even if there are no changes" ::: -nr, --noreload Update blacklist without refreshing dnsmasq
echo "::: -q, --quiet output is less verbose" ::: -f, --force Force updating of the hosts files, even if there are no changes
echo "::: -h, --help Show this help dialog" ::: -q, --quiet output is less verbose
echo "::: -l, --list Display your blacklisted domains" ::: -h, --help Show this help dialog
::: -l, --list Display your blacklisted domains
EOM
exit 1 exit 1
} }

View File

@ -122,15 +122,16 @@ normalChrono() {
} }
displayHelp() { displayHelp() {
echo "::: Displays stats about your piHole!" cat << EOM
echo ":::" ::: Displays stats about your piHole!
echo "::: Usage: sudo pihole -c [optional:-j]" :::
echo "::: Note: If no option is passed, then stats are displayed on screen, updated every 5 seconds" ::: Usage: sudo pihole -c [optional:-j]
echo ":::" ::: Note: If no option is passed, then stats are displayed on screen, updated every 5 seconds
echo "::: Options:" :::
echo "::: -j, --json output stats as JSON formatted string" ::: Options:
echo "::: -h, --help display this help text" ::: -j, --json output stats as JSON formatted string
::: -h, --help display this help text
EOM
exit 1 exit 1
} }

View File

@ -27,12 +27,14 @@ PIHOLELOG="/var/log/pihole.log"
WHITELISTMATCHES="/tmp/whitelistmatches.list" WHITELISTMATCHES="/tmp/whitelistmatches.list"
# Header info and introduction # Header info and introduction
echo "::: Beginning Pi-hole debug at $(date)!" cat << EOM
echo "::: This debugging process will collect information from your running configuration," ::: Beginning Pi-hole debug at $(date)!
echo "::: and optionally upload the generated log to a unique and random directory on" ::: This debugging process will collect information from your running configuration,
echo "::: Termbin.com. NOTE: All log files auto-delete after 1 month and you are the only" ::: and optionally upload the generated log to a unique and random directory on
echo "::: person who is given the unique URL. Please consider where you post this link." ::: 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.
:::
EOM
######## FIRST CHECK ######## ######## FIRST CHECK ########

View File

@ -72,19 +72,21 @@ coreOutput() {
} }
helpFunc() { helpFunc() {
echo ":::" cat << EOM
echo "::: Show Pi-hole/Web Admin versions" :::
echo ":::" ::: Show Pi-hole/Web Admin versions
echo "::: Usage: pihole -v [ -a | -p ] [ -l | -c ]" :::
echo ":::" ::: Usage: pihole -v [ -a | -p ] [ -l | -c ]
echo "::: Options:" :::
echo "::: -a, --admin Show both current and latest versions of web admin" ::: Options:
echo "::: -p, --pihole Show both current and latest versions of Pi-hole core files" ::: -a, --admin Show both current and latest versions of web admin
echo "::: -l, --latest (Only after -a | -p) Return only latest version" ::: -p, --pihole Show both current and latest versions of Pi-hole core files
echo "::: -c, --current (Only after -a | -p) Return only current version" ::: -l, --latest (Only after -a | -p) Return only latest version
echo "::: -h, --help Show this help dialog" ::: -c, --current (Only after -a | -p) Return only current version
echo ":::" ::: -h, --help Show this help dialog
exit 0 :::
EOM
exit 1
} }
if [[ $# = 0 ]]; then if [[ $# = 0 ]]; then

View File

@ -12,17 +12,19 @@
helpFunc() { helpFunc() {
echo "::: Immediately whitelists one or more domains in the hosts file" cat << EOM
echo ":::" ::: Immediately whitelists one or more domains in the hosts file
echo "::: Usage: pihole -w domain1 [domain2 ...]" :::
echo ":::" ::: Usage: pihole -w domain1 [domain2 ...]
echo "::: Options:" :::
echo "::: -d, --delmode Remove domains from the whitelist" ::: Options:
echo "::: -nr, --noreload Update Whitelist without refreshing dnsmasq" ::: -d, --delmode Remove domains from the whitelist
echo "::: -f, --force Force updating of the hosts files, even if there are no changes" ::: -nr, --noreload Update Whitelist without refreshing dnsmasq
echo "::: -q, --quiet output is less verbose" ::: -f, --force Force updating of the hosts files, even if there are no changes
echo "::: -h, --help Show this help dialog" ::: -q, --quiet output is less verbose
echo "::: -l, --list Display your whitelisted domains" ::: -h, --help Show this help dialog
::: -l, --list Display your whitelisted domains
EOM
exit 1 exit 1
} }

View File

@ -14,13 +14,15 @@
echo ":::" echo ":::"
helpFunc() { helpFunc() {
echo "::: Pull in domains from adlists" cat << EOM
echo ":::" ::: Pull in domains from adlists
echo "::: Usage: pihole -g" :::
echo ":::" ::: Usage: pihole -g
echo "::: Options:" :::
echo "::: -f, --force Force lists to be downloaded, even if they don't need updating." ::: Options:
echo "::: -h, --help Show this help dialog" ::: -f, --force Force lists to be downloaded, even if they don't need updating.
::: -h, --help Show this help dialog
EOM
exit 1 exit 1
} }