edit:add-var ipof~ [@argv]{ use str use moi/util/condition use moi/util/ip fn less [cmp e1 e2]{ < ($cmp $e1 $e2) 0 } fn sort-ip [e1 e2]{ var i1 = (condition:cset (ip:is-ipv4 $e1) 0 (condition:cset (ip:is-ipv6 $e1) 1 2)) var i2 = (condition:cset (ip:is-ipv4 $e2) 0 (condition:cset (ip:is-ipv6 $e2) 1 2)) if (!= $i1 $i2) { < $i1 $i2 } elif (== $i1 2) { (keys $solve[ips] | count) 0) { remote[$dd] = $solve } } $argv each [d]{ var exists = $false echo (styled 'Resolving '$d'…' bright-green) echo if (has-key $hosts $d) { exists = $true echo (styled ' local:' bright-yellow) keys $hosts[$d] | order &less-than=$sort-ip~ | each [ip]{ echo ' - '$ip } } if (and (has-key $remote $d) $remote[$d][remote]) { exists = $true var info = $remote[$d] echo (styled ' remote:' bright-yellow) echo ' IPs:' keys $info[ips] | order &less-than=$sort-ip~ | each [ip]{ echo ' - '$ip } echo ' Resolvers: '$info[resolvers] echo ' TXT records: '$info[txt] } if (not $exists) { echo (styled 'No info found' bright-red) } echo } $argv }