From 08d0e16cff5c98ff8f37603192ec01813330f868 Mon Sep 17 00:00:00 2001 From: Benjamin VAUDOUR Date: Wed, 13 Oct 2021 20:43:40 +0200 Subject: [PATCH] =?UTF-8?q?Pr=C3=A9paration=20=C3=A0=20elvish=200.17?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aliases/addbadips.elv | 8 ++++---- aliases/adguard.elv | 2 +- aliases/aliases.elv | 2 +- aliases/arc.elv | 10 +++++----- aliases/cleankh.elv | 4 ++-- aliases/commitkcp.elv | 6 +++--- aliases/digall.elv | 22 +++++++++++----------- aliases/get-uid.elv | 2 +- aliases/ipof.elv | 18 +++++++++--------- aliases/pdf2grey.elv | 14 +++++++------- aliases/publicip.elv | 6 +++--- 11 files changed, 47 insertions(+), 47 deletions(-) diff --git a/aliases/addbadips.elv b/aliases/addbadips.elv index f76ca3c..b4aa6aa 100644 --- a/aliases/addbadips.elv +++ b/aliases/addbadips.elv @@ -11,13 +11,13 @@ edit:add-var addbadips~ [@argv]{ var cond = (and (not (has-key $m $e)) (ip:is-ipv4 $e)) if $cond { echo $e ajoutée - c = (+ $c 1) - m[$e] = $nil - ips = [ (all $ips) $e ] + set c = (+ $c 1) + set m[$e] = $nil + set ips = [ (all $ips) $e ] } } $argv if (> $c 0) { - ips = [ (list:sort $ip:cmp4~ $ips) ] + set ips = [ (list:sort $ip:cmp4~ $ips) ] } var result = (str:join "\n" $ips) echo $result > $f diff --git a/aliases/adguard.elv b/aliases/adguard.elv index 3b98dcf..b11ecb9 100644 --- a/aliases/adguard.elv +++ b/aliases/adguard.elv @@ -4,7 +4,7 @@ edit:add-var adguard~ [@argv]{ var beg = 's|^.*\(192\.168\.0\.25\)|' var end = 'nameserver \1|' if (and (> (count $argv) 0) (str:has-prefix $argv[0] u)) { - end = '# '$end + set end = '# '$end } sudo sed -i $beg$end /etc/resolv.conf sudo chattr +i /etc/resolv.conf diff --git a/aliases/aliases.elv b/aliases/aliases.elv index 32a07b7..a182525 100644 --- a/aliases/aliases.elv +++ b/aliases/aliases.elv @@ -4,7 +4,7 @@ edit:add-var curl~ $e:curlie~ edit:add-var df~ $e:duf~ edit:add-var diff~ $e:colordiff~ edit:add-var dig~ [@argv]{ e:dig +noall +answer $@argv } -edit:add-var dogall~ [@argv]{ e:dog A AAAA CNAME PTR TXT MX SRV NS SOA $@argv } +edit:add-var dogall~ [@argv]{ e:dog A AAAA CNAME TXT MX NS SOA $@argv } edit:add-var du~ [@argv]{ e:du -h $@argv } edit:add-var git~ $e:hub~ edit:add-var grep~ [@argv]{ e:grep --color=tty -d skip $@argv } diff --git a/aliases/arc.elv b/aliases/arc.elv index 682f532..611c807 100644 --- a/aliases/arc.elv +++ b/aliases/arc.elv @@ -1,8 +1,8 @@ -cmd = $e:arc~ +var cmd = $e:arc~ edit:add-var archiver~ [@argv]{ use str - help = { + var help = { echo "Usage : archiver [(-zlxgb)] " return } @@ -11,7 +11,7 @@ edit:add-var archiver~ [@argv]{ } var format o = zst $argv[0] if (and (str:has-prefix $o -) (> (count $o) 1)) { - o = $o[1] + set o = $o[1] var m = [ &z=zst &l=lz4 @@ -22,7 +22,7 @@ edit:add-var archiver~ [@argv]{ if (not (has-key $m $o)) { $help } - format argv = $m[$o] $argv[1..] + set format argv = $m[$o] $argv[1..] } if (== (count $argv) 0) { $help @@ -30,7 +30,7 @@ edit:add-var archiver~ [@argv]{ peach [f]{ var ff = $f if (eq $ff[-1] /) { - f = $ff[..-1] + set f = $ff[..-1] } $cmd archive $ff'.tar.'$format $ff echo "'"$ff"'" archivé diff --git a/aliases/cleankh.elv b/aliases/cleankh.elv index 0fb5e19..588be69 100644 --- a/aliases/cleankh.elv +++ b/aliases/cleankh.elv @@ -20,10 +20,10 @@ edit:add-var cleankh~ [@argv]{ cat ~/.ssh/known_hosts | eawk [_ hosts @rest]{ var key = (str:join ' ' $rest) if (not (has-key $khosts $key)) { - khosts[$key] = [&] + set khosts[$key] = [&] } str:split , $hosts | each [h]{ - khosts[$key][$h] = $nil + set khosts[$key][$h] = $nil } } diff --git a/aliases/commitkcp.elv b/aliases/commitkcp.elv index dd45b04..b5403f3 100644 --- a/aliases/commitkcp.elv +++ b/aliases/commitkcp.elv @@ -6,13 +6,13 @@ edit:add-var commitkcp~ [@argv]{ ] keys $m | each [k]{ - var p = 'pkg'$k'=' - m[$k] = (str:trim-prefix (cat PKGBUILD | grep $p | take 1) $p) + var p = 'pkg'$k'=' + set m[$k] = (str:trim-prefix (cat PKGBUILD | grep $p | take 1) $p) } var msg = $m[name]' '$m[ver] if (> (count $argv) 0) { - msg = $msg' - '(str:join ' ' $argv) + set msg = $msg' - '(str:join ' ' $argv) } echo "git commit -am '"$msg"' ; git push" diff --git a/aliases/digall.elv b/aliases/digall.elv index d682870..646877b 100644 --- a/aliases/digall.elv +++ b/aliases/digall.elv @@ -21,7 +21,7 @@ edit:add-var digall~ [@argv]{ [&min=10] ] var records servers = [] [] - var flags = [ + var flags = [ +noall +answer ] @@ -29,22 +29,22 @@ edit:add-var digall~ [@argv]{ fn init []{ if (and (> (count $argv) 0) (is $argv[0] -d)) { - use_dig = $false - argv = $argv[1:] + set use_dig = $false + set argv = $argv[1:] } each [e]{ if (is $e[0] '+') { - flags = [ (all $flags) $e ] + set flags = [ (all $flags) $e ] } elif (is $e[0] @) { - servers = [ (all $servers) $e ] + set servers = [ (all $servers) $e ] } elif (list:includes $e $default_records) { - records = [ (all $records) $e ] + set records = [ (all $records) $e ] } else { - domains = [ (all $domains) $e ] + set domains = [ (all $domains) $e ] } } $argv if (== (count $records) 0) { - records = $default_records + set records = $default_records } } @@ -54,7 +54,7 @@ edit:add-var digall~ [@argv]{ } $results | list:remove-duplicate | list:sort [l1 l2]{ var c = (str:compare $l1[0] $l2[0]) if (== $c 0) { - c = (str:compare $l1[2] $l2[2]) + set c = (str:compare $l1[2] $l2[2]) } } | strutil:format &col=$cols | str:join "\n" } @@ -92,10 +92,10 @@ edit:add-var digall~ [@argv]{ var results = [ (echo (styled 'Domaine: '$d bright-green)) ] if (> (count $servers) 0) { each [s]{ - @results = $@results (digs $s $d) + set @results = $@results (digs $s $d) } $servers } else { - @results = $@results (req $d) + set @results = $@results (req $d) } echo (str:join "\n" $results) } diff --git a/aliases/get-uid.elv b/aliases/get-uid.elv index 9070e8a..fac9a08 100644 --- a/aliases/get-uid.elv +++ b/aliases/get-uid.elv @@ -25,7 +25,7 @@ fn -get-id []{ str:split ' ' (id) | each [e]{ var p = [ (str:split '=' $e) ] if (== (count $p) 2) { - id[$p[0]] = (-values $p[1]) + set id[$p[0]] = (-values $p[1]) } } put $id diff --git a/aliases/ipof.elv b/aliases/ipof.elv index 845ac99..4256687 100644 --- a/aliases/ipof.elv +++ b/aliases/ipof.elv @@ -33,15 +33,15 @@ edit:add-var ipof~ [@argv]{ str:split ', ' $value | peach [e]{ var ee = $e if (ip:is-ip $ee) { - result[ips][$ee] = $nil + set result[ips][$ee] = $nil } } } elif (str:has-prefix $ll 'TXT records') { - result[txt] = $value + set result[txt] = $value } elif (str:has-prefix $ll 'Resolver') { - result[resolvers] = $value + set result[resolvers] = $value } elif (str:has-prefix $ll 'Name servers') { - result[remote] = (not-eq $value 'name does not exist') + set result[remote] = (not-eq $value 'name does not exist') } } put $result @@ -57,9 +57,9 @@ edit:add-var ipof~ [@argv]{ peach [d]{ var dd = $d if (has-key $hosts $dd) { - hosts[$dd][$ip] = $nil + set hosts[$dd][$ip] = $nil } else { - hosts[$dd] = [&$ip=$nil] + set hosts[$dd] = [&$ip=$nil] } } $domains } @@ -69,7 +69,7 @@ edit:add-var ipof~ [@argv]{ var dd = $d var solve = (dnssolve $dd) if (> (keys $solve[ips] | count) 0) { - remote[$dd] = $solve + set remote[$dd] = $solve } } $argv @@ -78,14 +78,14 @@ edit:add-var ipof~ [@argv]{ echo (styled 'Resolving '$d'…' bright-green) echo if (has-key $hosts $d) { - exists = $true + set 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 + set exists = $true var info = $remote[$d] echo (styled ' remote:' bright-yellow) echo ' IPs:' diff --git a/aliases/pdf2grey.elv b/aliases/pdf2grey.elv index f44bb03..dc63cae 100644 --- a/aliases/pdf2grey.elv +++ b/aliases/pdf2grey.elv @@ -32,15 +32,15 @@ edit:add-var pdf2grey~ [@argv]{ _help return } elif (eq $e -n) { - m[nb] = $true + set m[nb] = $true if (== (count $e) 0) { echo 'Il manque des arguments après -s' _help return } elif (is_int $argv[0]) { - e @argv = $@argv + set e @argv = $@argv if (is_split $e) { - m[split] = $e + set m[split] = $e } else { echo 'L’argument (optionnel) après -s doit être compris entre 0 et 100' _help @@ -52,9 +52,9 @@ edit:add-var pdf2grey~ [@argv]{ _help return } elif (not (has-key $m input)) { - m[input] = $e + set m[input] = $e } else { - m[output] = $e + set m[output] = $e if (> (count $argv) 0) { echo 'Trop d’arguments: '$@argv _help @@ -74,9 +74,9 @@ edit:add-var pdf2grey~ [@argv]{ var params = [-colorspace gray] if $m[nb] { - @params = (all $params) -threshold $m[split]'%' + set @params = (all $params) -threshold $m[split]'%' } - @params = $@params $m[input] $m[output] + set @params = $@params $m[input] $m[output] echo 'Commande: convert '(str:join ' ' $params) convert $@params } diff --git a/aliases/publicip.elv b/aliases/publicip.elv index deca906..66c5148 100644 --- a/aliases/publicip.elv +++ b/aliases/publicip.elv @@ -1,8 +1,8 @@ edit:add-var publicip~ [@argv]{ - f = [t]{ + var f = [t]{ use moi/util/condition - t = (condition:cset (eq $t -6) -6 -4) - l = (condition:cset (eq $t -6) 'IPv6: ' 'IPv4: ') + set t = (condition:cset (eq $t -6) -6 -4) + var l = (condition:cset (eq $t -6) 'IPv6: ' 'IPv4: ') curl $t ifconfig.co/ip 2> /dev/null | each [ip]{ echo (styled $l bold yellow) $ip } } $f -4