From 29b548f07c94618ea683fbd533bf28d45df2b09a Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Fri, 26 Aug 2016 09:39:27 +0100 Subject: [PATCH 1/2] Add queryfunc --- pihole | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pihole b/pihole index 64a36c59..0b67d6c0 100755 --- a/pihole +++ b/pihole @@ -62,6 +62,11 @@ function setupLCDFunction { exit 1 } +function queryFunc { + for list in /etc/pihole/list.*;do echo $list;grep '$@' $list;done + exit 1 +} + function chronometerFunc { shift $SUDO /opt/pihole/chronometer.sh "$@" @@ -96,6 +101,7 @@ function helpFunc { echo "::: -c, chronometer Calculates stats and displays to an LCD" echo "::: -h, help Show this help dialog" echo "::: -v, version Show current versions" + echo "::: -q, query Query the adlists for a specific domain" echo "::: uninstall Uninstall Pi-Hole from your system :(!" exit 1 } @@ -116,6 +122,7 @@ case "$1" in "-c" | "chronometer" ) chronometerFunc "$@";; "-h" | "help" ) helpFunc;; "-v" | "version" ) versionFunc;; +"-q" | "query" ) queryFunc;; "uninstall" ) uninstallFunc;; * ) helpFunc;; esac From 77135ca3c74a6aca0265b0696aadd73f01b051ad Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Fri, 26 Aug 2016 10:09:39 +0100 Subject: [PATCH 2/2] Actually pass through the argument to the function --- pihole | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pihole b/pihole index 0b67d6c0..7d0f4c18 100755 --- a/pihole +++ b/pihole @@ -63,7 +63,8 @@ function setupLCDFunction { } function queryFunc { - for list in /etc/pihole/list.*;do echo $list;grep '$@' $list;done + domain=$2 + for list in /etc/pihole/list.*;do echo $list;grep ${domain} $list;done exit 1 } @@ -122,7 +123,7 @@ case "$1" in "-c" | "chronometer" ) chronometerFunc "$@";; "-h" | "help" ) helpFunc;; "-v" | "version" ) versionFunc;; -"-q" | "query" ) queryFunc;; +"-q" | "query" ) queryFunc "$@";; "uninstall" ) uninstallFunc;; * ) helpFunc;; esac