Imbue gravity.sh with some consistency

Mish-mash of tabs and spaces used for indentation. Mostly tabs though,
so going with those. Also indenting blocks and enforcing the

loop statement; do
done

style over the newline for do since it seemed to be more common.
This commit is contained in:
Marcus Hildum 2016-10-21 23:02:45 -07:00
parent 5ebfa5ecf7
commit aac8e45397

View file

@ -151,8 +151,7 @@ gravity_transport() {
gravity_spinup() { gravity_spinup() {
echo ":::" echo ":::"
# Loop through domain list. Download each one and remove commented lines (lines beginning with '# 'or '/') and # blank lines # Loop through domain list. Download each one and remove commented lines (lines beginning with '# 'or '/') and # blank lines
for ((i = 0; i < "${#sources[@]}"; i++)) for ((i = 0; i < "${#sources[@]}"; i++)); do
do
url=${sources[$i]} url=${sources[$i]}
# Get just the domain from the URL # Get just the domain from the URL
domain=$(echo "$url" | cut -d'/' -f3) domain=$(echo "$url" | cut -d'/' -f3)
@ -190,8 +189,7 @@ gravity_Schwarzchild() {
# Find all active domains and compile them into one file and remove CRs # Find all active domains and compile them into one file and remove CRs
echo -n "::: Aggregating list of domains..." echo -n "::: Aggregating list of domains..."
truncate -s 0 ${piholeDir}/${matterAndLight} truncate -s 0 ${piholeDir}/${matterAndLight}
for i in "${activeDomains[@]}" for i in "${activeDomains[@]}"; do
do
cat "$i" | tr -d '\r' >> ${piholeDir}/${matterAndLight} cat "$i" | tr -d '\r' >> ${piholeDir}/${matterAndLight}
done done
echo " done!" echo " done!"
@ -214,8 +212,7 @@ gravity_Whitelist() {
echo -n "::: Adding ${#sources[@]} adlist source${plural} to the whitelist..." echo -n "::: Adding ${#sources[@]} adlist source${plural} to the whitelist..."
urls=() urls=()
for url in "${sources[@]}" for url in "${sources[@]}"; do
do
tmp=$(echo "$url" | awk -F '/' '{print $3}') tmp=$(echo "$url" | awk -F '/' '{print $3}')
urls=("${urls[@]}" ${tmp}) urls=("${urls[@]}" ${tmp})
done done
@ -266,8 +263,7 @@ gravity_hostFormat() {
# blackbody - remove any remnant files from script processes # blackbody - remove any remnant files from script processes
gravity_blackbody() { gravity_blackbody() {
# Loop through list files # Loop through list files
for file in ${piholeDir}/*.${justDomainsExtension} for file in ${piholeDir}/*.${justDomainsExtension}; do
do
# If list is in active array then leave it (noop) else rm the list # If list is in active array then leave it (noop) else rm the list
if [[ " ${activeDomains[@]} " =~ ${file} ]]; then if [[ " ${activeDomains[@]} " =~ ${file} ]]; then
: :
@ -333,8 +329,7 @@ gravity_reload() {
} }
for var in "$@" for var in "$@"; do
do
case "$var" in case "$var" in
"-f" | "--force" ) forceGrav=true;; "-f" | "--force" ) forceGrav=true;;
"-h" | "--help" ) helpFunc;; "-h" | "--help" ) helpFunc;;