diff --git a/aliases/digall.elv b/aliases/digall.elv index cdea25d..0bb8ff2 100644 --- a/aliases/digall.elv +++ b/aliases/digall.elv @@ -22,8 +22,13 @@ fn digall [@_args]{ +answer ] local:domains = [] + local:use_dig = $true fn init []{ + if (and (> (count $_args) 0) (is $_args[0] -d)) { + use_dig = $false + _args = $_args[1:] + } each [e]{ if (is $e[0] '+') { flags = [ (all $flags) $e ] @@ -39,18 +44,34 @@ fn digall [@_args]{ records = $default_records } } + + fn drillr [d @args]{ + local:results = [ (peach [r]{ + e:drill $@args $r $d | list:filter [e]{ + and (> (count $e) 2) (not (is $e[:2] ';;')) + } + } $records | list:remove-duplicate) ] + echo (str:join "\n" $results) + } fn digr [d @args]{ - local:results = [ (each [r]{ + local:results = [ (peach [r]{ e:dig $@args $r $d $@flags - } $records) ] - results = [ (list:remove-duplicate $results) ] + } $records | list:remove-duplicate) ] echo (str:join "\n" $results) } + + fn req [d @args]{ + if $use_dig { + digr $d $@args + } else { + drillr $d $@args + } + } fn digs [s d]{ echo (styled $s bright-yellow) - digr $d $s + req $d $s } fn digd [d]{ @@ -60,7 +81,7 @@ fn digall [@_args]{ digs $s $d } $servers } else { - digr $d + req $d } }