mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-29 09:33:16 +00:00
Use natural langauge for list manipulations, like pihole allow example.com or pihole deny other.net. Also remove using pihole deny not bad.org
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
fe8e63853c
commit
ccdbfd4130
4 changed files with 39 additions and 43 deletions
|
@ -47,11 +47,10 @@ Example: 'pihole ${abbrv} site.com', or 'pihole ${abbrv} site1.com site2.com'
|
||||||
${typeId^} one or more ${kindId} domains
|
${typeId^} one or more ${kindId} domains
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-d, --delmode Remove domain(s)
|
not -d, --delmode Remove domain(s)
|
||||||
-q, --quiet Make output less verbose
|
-q, --quiet Make output less verbose
|
||||||
-h, --help Show this help dialog
|
-h, --help Show this help dialog
|
||||||
-l, --list Display domains
|
-l, --list Display domains
|
||||||
--nuke Removes all entries in a list
|
|
||||||
--comment \"text\" Add a comment to the domain. If adding multiple domains the same comment will be used for all"
|
--comment \"text\" Add a comment to the domain. If adding multiple domains the same comment will be used for all"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -198,13 +197,13 @@ GetComment() {
|
||||||
|
|
||||||
while (( "$#" )); do
|
while (( "$#" )); do
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
"-a" | "allowlist" ) kindId="exact"; typeId="allow"; abbrv="-a";;
|
"allow" | "allowlist" ) kindId="exact"; typeId="allow"; abbrv="allow";;
|
||||||
"-b" | "denylist" ) kindId="exact"; typeId="deny"; abbrv="-b";;
|
"deny" | "denylist" ) kindId="exact"; typeId="deny"; abbrv="deny";;
|
||||||
"--allow-regex" | "allow-regex" ) kindId="regex"; typeId="allow"; abbrv="--allow-regex";;
|
"--allow-regex" | "allow-regex" ) kindId="regex"; typeId="allow"; abbrv="--allow-regex";;
|
||||||
"--allow-wild" | "allow-wild" ) kindId="regex"; typeId="allow"; wildcard=true; abbrv="--allow-wild";;
|
"--allow-wild" | "allow-wild" ) kindId="regex"; typeId="allow"; wildcard=true; abbrv="--allow-wild";;
|
||||||
"--regex" | "regex" ) kindId="regex"; typeId="deny"; abbrv="--regex";;
|
"--regex" | "regex" ) kindId="regex"; typeId="deny"; abbrv="--regex";;
|
||||||
"--wild" | "wildcard" ) kindId="regex"; typeId="deny"; wildcard=true; abbrv="--wild";;
|
"--wild" | "wildcard" ) kindId="regex"; typeId="deny"; wildcard=true; abbrv="--wild";;
|
||||||
"-d" | "--delmode" ) addmode=false;;
|
"-d" | "not" | "--delmode" ) addmode=false;;
|
||||||
"-q" | "--quiet" ) verbose=false;;
|
"-q" | "--quiet" ) verbose=false;;
|
||||||
"-h" | "--help" ) helpFunc;;
|
"-h" | "--help" ) helpFunc;;
|
||||||
"-l" | "--list" ) Displaylist;;
|
"-l" | "--list" ) Displaylist;;
|
||||||
|
|
|
@ -7,11 +7,11 @@ _pihole() {
|
||||||
|
|
||||||
case "${prev}" in
|
case "${prev}" in
|
||||||
"pihole")
|
"pihole")
|
||||||
opts="blacklist checkout debug disable enable flush help logging query reconfigure regex restartdns status tail uninstall updateGravity updatePihole version wildcard whitelist arpflush"
|
opts="allow allow-regex allow-wild deny checkout debug disable enable flush help logging query reconfigure regex restartdns status tail uninstall updateGravity updatePihole version wildcard arpflush"
|
||||||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
||||||
;;
|
;;
|
||||||
"whitelist"|"blacklist"|"wildcard"|"regex")
|
"allow"|"deny"|"wildcard"|"regex"|"allow-regx"|"allow-wild")
|
||||||
opts_lists="\--delmode \--noreload \--quiet \--list \--nuke"
|
opts_lists="\not \--delmode \--quiet \--list \--help"
|
||||||
COMPREPLY=( $(compgen -W "${opts_lists}" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "${opts_lists}" -- ${cur}) )
|
||||||
;;
|
;;
|
||||||
"checkout")
|
"checkout")
|
||||||
|
|
|
@ -52,48 +52,44 @@ pihole restartdns\fR [options]
|
||||||
Available commands and options:
|
Available commands and options:
|
||||||
.br
|
.br
|
||||||
|
|
||||||
\fB-w, whitelist\fR [options] [<domain1> <domain2 ...>]
|
\fBallow, allowlist\fR [options] [<domain1> <domain2 ...>]
|
||||||
.br
|
.br
|
||||||
Adds or removes specified domain or domains to the Whitelist
|
Adds or removes specified domain or domains to the Allowlist
|
||||||
.br
|
.br
|
||||||
|
|
||||||
\fB-b, blacklist\fR [options] [<domain1> <domain2 ...>]
|
\fBdeny, denylist\fR [options] [<domain1> <domain2 ...>]
|
||||||
.br
|
.br
|
||||||
Adds or removes specified domain or domains to the blacklist
|
Adds or removes specified domain or domains to the denylist
|
||||||
.br
|
.br
|
||||||
|
|
||||||
\fB--regex, regex\fR [options] [<regex1> <regex2 ...>]
|
\fB--regex, regex\fR [options] [<regex1> <regex2 ...>]
|
||||||
.br
|
.br
|
||||||
Add or removes specified regex filter to the regex blacklist
|
Add or removes specified regex filter to the regex denylist
|
||||||
.br
|
.br
|
||||||
|
|
||||||
\fB--white-regex\fR [options] [<regex1> <regex2 ...>]
|
\fB--allow-regex\fR [options] [<regex1> <regex2 ...>]
|
||||||
.br
|
.br
|
||||||
Add or removes specified regex filter to the regex whitelist
|
Add or removes specified regex filter to the regex allowlist
|
||||||
.br
|
.br
|
||||||
|
|
||||||
\fB--wild, wildcard\fR [options] [<domain1> <domain2 ...>]
|
\fB--wild, wildcard\fR [options] [<domain1> <domain2 ...>]
|
||||||
.br
|
.br
|
||||||
Add or removes specified domain to the wildcard blacklist
|
Add or removes specified domain to the wildcard denylist
|
||||||
.br
|
.br
|
||||||
|
|
||||||
\fB--white-wild\fR [options] [<domain1> <domain2 ...>]
|
\fB--allow-wild\fR [options] [<domain1> <domain2 ...>]
|
||||||
.br
|
.br
|
||||||
Add or removes specified domain to the wildcard whitelist
|
Add or removes specified domain to the wildcard allowlist
|
||||||
.br
|
.br
|
||||||
|
|
||||||
(Whitelist/Blacklist manipulation options):
|
(Allow-/denylist manipulation options):
|
||||||
.br
|
.br
|
||||||
-d, --delmode Remove domain(s) from the list
|
not, -d, --delmode Remove domain(s) from the list
|
||||||
.br
|
|
||||||
-nr, --noreload Update list without refreshing dnsmasq
|
|
||||||
.br
|
.br
|
||||||
-q, --quiet Make output less verbose
|
-q, --quiet Make output less verbose
|
||||||
.br
|
.br
|
||||||
-l, --list Display all your listed domains
|
-l, --list Display all your listed domains
|
||||||
.br
|
.br
|
||||||
--nuke Removes all entries in a list
|
|
||||||
.br
|
|
||||||
|
|
||||||
\fB-d, debug\fR [-a]
|
\fB-d, debug\fR [-a]
|
||||||
.br
|
.br
|
||||||
|
@ -279,17 +275,17 @@ Available commands and options:
|
||||||
Some usage examples
|
Some usage examples
|
||||||
.br
|
.br
|
||||||
|
|
||||||
Whitelist/blacklist manipulation
|
Allow-/denylist manipulation
|
||||||
.br
|
.br
|
||||||
|
|
||||||
\fBpihole -w iloveads.example.com\fR
|
\fBpihole allow iloveads.example.com\fR
|
||||||
.br
|
.br
|
||||||
Adds "iloveads.example.com" to whitelist
|
Allow "iloveads.example.com"
|
||||||
.br
|
.br
|
||||||
|
|
||||||
\fBpihole -b -d noads.example.com\fR
|
\fBpihole deny not noads.example.com\fR
|
||||||
.br
|
.br
|
||||||
Removes "noads.example.com" from blacklist
|
Removes "noads.example.com" from denylist
|
||||||
.br
|
.br
|
||||||
|
|
||||||
\fBpihole --wild example.com\fR
|
\fBpihole --wild example.com\fR
|
||||||
|
|
25
pihole
25
pihole
|
@ -472,17 +472,17 @@ unsupportedFunc(){
|
||||||
|
|
||||||
helpFunc() {
|
helpFunc() {
|
||||||
echo "Usage: pihole [options]
|
echo "Usage: pihole [options]
|
||||||
Example: 'pihole -a -h'
|
Example: 'pihole allow -h'
|
||||||
Add '-h' after specific commands for more information on usage
|
Add '-h' after specific commands for more information on usage
|
||||||
|
|
||||||
Domain Options:
|
Domain Options:
|
||||||
-a, allowlist Allowlist domain(s)
|
allow, allowlist Allow domain(s)
|
||||||
-b, denylist Denylist domain(s)
|
deny, denylist Deny domain(s)
|
||||||
--regex, regex Regex denylist domains(s)
|
--regex, regex Regex deny domains(s)
|
||||||
--allow-regex Regex allowlist domains(s)
|
--allow-regex Regex allow domains(s)
|
||||||
--wild, wildcard Wildcard denylist domain(s)
|
--wild, wildcard Wildcard deny domain(s)
|
||||||
--allow-wild Wildcard allowlist domain(s)
|
--allow-wild Wildcard allow domain(s)
|
||||||
Add '-h' for more info on allowlist/denylist usage
|
Add '-h' for more info on allow/deny usage
|
||||||
|
|
||||||
Debugging Options:
|
Debugging Options:
|
||||||
-d, debug Start a debugging session
|
-d, debug Start a debugging session
|
||||||
|
@ -537,8 +537,8 @@ case "${1}" in
|
||||||
"tricorder" ) tricorderFunc;;
|
"tricorder" ) tricorderFunc;;
|
||||||
|
|
||||||
# we need to add all arguments that require sudo power to not trigger the * argument
|
# we need to add all arguments that require sudo power to not trigger the * argument
|
||||||
"-a" | "allowlist" ) need_root=0;;
|
"allow" | "allowlist" ) need_root=0;;
|
||||||
"-b" | "blocklist" | "denylist" ) need_root=0;;
|
"deny" | "denylist" ) need_root=0;;
|
||||||
"--wild" | "wildcard" ) need_root=0;;
|
"--wild" | "wildcard" ) need_root=0;;
|
||||||
"--regex" | "regex" ) need_root=0;;
|
"--regex" | "regex" ) need_root=0;;
|
||||||
"--allow-regex" | "allow-regex" ) need_root=0;;
|
"--allow-regex" | "allow-regex" ) need_root=0;;
|
||||||
|
@ -578,8 +578,8 @@ fi
|
||||||
|
|
||||||
# Handle redirecting to specific functions based on arguments
|
# Handle redirecting to specific functions based on arguments
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
"-a" | "allowlist" ) listFunc "$@";;
|
"allow" | "allowlist" ) listFunc "$@";;
|
||||||
"-b" | "blocklist" | "denylist" ) listFunc "$@";;
|
"deny" | "denylist" ) listFunc "$@";;
|
||||||
"--wild" | "wildcard" ) listFunc "$@";;
|
"--wild" | "wildcard" ) listFunc "$@";;
|
||||||
"--regex" | "regex" ) listFunc "$@";;
|
"--regex" | "regex" ) listFunc "$@";;
|
||||||
"--allow-regex" | "allow-regex" ) listFunc "$@";;
|
"--allow-regex" | "allow-regex" ) listFunc "$@";;
|
||||||
|
@ -600,4 +600,5 @@ case "${1}" in
|
||||||
"updatechecker" ) shift; updateCheckFunc "$@";;
|
"updatechecker" ) shift; updateCheckFunc "$@";;
|
||||||
"arpflush" ) arpFunc "$@";;
|
"arpflush" ) arpFunc "$@";;
|
||||||
"-t" | "tail" ) tailFunc "$2";;
|
"-t" | "tail" ) tailFunc "$2";;
|
||||||
|
* ) helpFunc;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in a new issue