Rename --unfiltered to --all

This commit is contained in:
2025-08-07 21:03:25 +02:00
parent 9ecf72e2e9
commit f5af05fb50
3 changed files with 9 additions and 9 deletions

View File

@@ -12,10 +12,10 @@ List available DNS zones.
Options:
-c, --config path to config file
-h, --help print this help message
-j, --json print json format
-J, --json-pretty print pretty json format (implies -j)
-r, --raw print raw format
-h, --help print this help message
EOF
exit

View File

@@ -11,24 +11,24 @@ Usage: $SCRIPT [OPTIONS]... ZONE[@VIEW]
Show DNS zone content.
Options:
-a, --all do not ignore unsupported record types
-c, --config path to config file
-h, --help print this help message
-i, --interactive interactively ask for missing arguments
-j, --json print json format
-J, --json-pretty print pretty json format (implies -j)
-r, --raw print raw format
-u, --unfiltered also print not supported record types
EOF
exit
}
all=false
config_file="/etc/dns-manager/config.sh"
interactive=false
json=false
json_pretty=false
raw=false
unfiltered=false
zone=""
declare -a args=()
@@ -36,6 +36,9 @@ while [ -n "$1" ]; do
opt=$1
shift
case "$opt" in
-a|--all)
all=true
;;
-c|--config)
if [ -z "$1" ]; then
echo "$SCRIPT: missing argument to option -- '$opt'" >&2
@@ -60,9 +63,6 @@ while [ -n "$1" ]; do
-r|--raw)
raw=true
;;
-u|--unfiltered)
unfiltered=true
;;
-*)
echo "$SCRIPT: invalid option -- '$opt'" >&2
exit 1
@@ -108,7 +108,7 @@ else
fi
for view in "${views[@]}"; do
output["$view"]=$(dns_zone "$zone" "$view" "$unfiltered") || exit 12
output["$view"]=$(dns_zone "$zone" "$view" "$all") || exit 12
done
if $raw; then

View File

@@ -207,7 +207,7 @@ dns_zone_views() {
dns_zone() {
local zone=$1
local view=$2
local unfiltered=${3:-false}
local all=${3:-false}
local keyfile
_get_keyfile keyfile "$zone" "$view" || return $?
@@ -234,7 +234,7 @@ dns_zone() {
local query='.'
local rtypes="[]"
if ! $unfiltered; then
if ! $all; then
query='[ .[] | select(.type | IN($rtypes[])) ]'
rtypes=$(printf "%s\n" "${DNS_RECORD_TYPES[@]}" | bash_array_to_json)
fi