Rename --unfiltered to --all
This commit is contained in:
@@ -12,10 +12,10 @@ List available DNS zones.
|
|||||||
|
|
||||||
Options:
|
Options:
|
||||||
-c, --config path to config file
|
-c, --config path to config file
|
||||||
|
-h, --help print this help message
|
||||||
-j, --json print json format
|
-j, --json print json format
|
||||||
-J, --json-pretty print pretty json format (implies -j)
|
-J, --json-pretty print pretty json format (implies -j)
|
||||||
-r, --raw print raw format
|
-r, --raw print raw format
|
||||||
-h, --help print this help message
|
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
exit
|
exit
|
||||||
|
|||||||
@@ -11,24 +11,24 @@ Usage: $SCRIPT [OPTIONS]... ZONE[@VIEW]
|
|||||||
Show DNS zone content.
|
Show DNS zone content.
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
-a, --all do not ignore unsupported record types
|
||||||
-c, --config path to config file
|
-c, --config path to config file
|
||||||
-h, --help print this help message
|
-h, --help print this help message
|
||||||
-i, --interactive interactively ask for missing arguments
|
-i, --interactive interactively ask for missing arguments
|
||||||
-j, --json print json format
|
-j, --json print json format
|
||||||
-J, --json-pretty print pretty json format (implies -j)
|
-J, --json-pretty print pretty json format (implies -j)
|
||||||
-r, --raw print raw format
|
-r, --raw print raw format
|
||||||
-u, --unfiltered also print not supported record types
|
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
all=false
|
||||||
config_file="/etc/dns-manager/config.sh"
|
config_file="/etc/dns-manager/config.sh"
|
||||||
interactive=false
|
interactive=false
|
||||||
json=false
|
json=false
|
||||||
json_pretty=false
|
json_pretty=false
|
||||||
raw=false
|
raw=false
|
||||||
unfiltered=false
|
|
||||||
zone=""
|
zone=""
|
||||||
|
|
||||||
declare -a args=()
|
declare -a args=()
|
||||||
@@ -36,6 +36,9 @@ while [ -n "$1" ]; do
|
|||||||
opt=$1
|
opt=$1
|
||||||
shift
|
shift
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
|
-a|--all)
|
||||||
|
all=true
|
||||||
|
;;
|
||||||
-c|--config)
|
-c|--config)
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
echo "$SCRIPT: missing argument to option -- '$opt'" >&2
|
echo "$SCRIPT: missing argument to option -- '$opt'" >&2
|
||||||
@@ -60,9 +63,6 @@ while [ -n "$1" ]; do
|
|||||||
-r|--raw)
|
-r|--raw)
|
||||||
raw=true
|
raw=true
|
||||||
;;
|
;;
|
||||||
-u|--unfiltered)
|
|
||||||
unfiltered=true
|
|
||||||
;;
|
|
||||||
-*)
|
-*)
|
||||||
echo "$SCRIPT: invalid option -- '$opt'" >&2
|
echo "$SCRIPT: invalid option -- '$opt'" >&2
|
||||||
exit 1
|
exit 1
|
||||||
@@ -108,7 +108,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
for view in "${views[@]}"; do
|
for view in "${views[@]}"; do
|
||||||
output["$view"]=$(dns_zone "$zone" "$view" "$unfiltered") || exit 12
|
output["$view"]=$(dns_zone "$zone" "$view" "$all") || exit 12
|
||||||
done
|
done
|
||||||
|
|
||||||
if $raw; then
|
if $raw; then
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ dns_zone_views() {
|
|||||||
dns_zone() {
|
dns_zone() {
|
||||||
local zone=$1
|
local zone=$1
|
||||||
local view=$2
|
local view=$2
|
||||||
local unfiltered=${3:-false}
|
local all=${3:-false}
|
||||||
|
|
||||||
local keyfile
|
local keyfile
|
||||||
_get_keyfile keyfile "$zone" "$view" || return $?
|
_get_keyfile keyfile "$zone" "$view" || return $?
|
||||||
@@ -234,7 +234,7 @@ dns_zone() {
|
|||||||
local query='.'
|
local query='.'
|
||||||
local rtypes="[]"
|
local rtypes="[]"
|
||||||
|
|
||||||
if ! $unfiltered; then
|
if ! $all; then
|
||||||
query='[ .[] | select(.type | IN($rtypes[])) ]'
|
query='[ .[] | select(.type | IN($rtypes[])) ]'
|
||||||
rtypes=$(printf "%s\n" "${DNS_RECORD_TYPES[@]}" | bash_array_to_json)
|
rtypes=$(printf "%s\n" "${DNS_RECORD_TYPES[@]}" | bash_array_to_json)
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user