From f8a35a9da3497a0e8c1e0e121f0b092b274161a2 Mon Sep 17 00:00:00 2001 From: Benjamin VAUDOUR Date: Sat, 28 Aug 2021 10:58:07 +0200 Subject: [PATCH] =?UTF-8?q?Correction=20probl=C3=A8me=20des=20peach?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aliases/arc.elv | 20 ++++++++++---------- aliases/ipof.elv | 27 +++++++++++++-------------- lib/moi/util/file.elv | 3 --- lib/moi/util/list.elv | 1 - 4 files changed, 23 insertions(+), 28 deletions(-) diff --git a/aliases/arc.elv b/aliases/arc.elv index 152bc30..682f532 100644 --- a/aliases/arc.elv +++ b/aliases/arc.elv @@ -28,26 +28,26 @@ edit:add-var archiver~ [@argv]{ $help } peach [f]{ - var f = $f - if (eq $f[-1] /) { - f = $f[..-1] + var ff = $f + if (eq $ff[-1] /) { + f = $ff[..-1] } - $cmd archive $f'.tar.'$format $f - echo "'"$f"'" archivé + $cmd archive $ff'.tar.'$format $ff + echo "'"$ff"'" archivé } $argv } edit:add-var desarchiver~ [@argv]{ peach [f]{ - var f = $f - $cmd unarchive $f - echo "'"$f"'" désarchivé + var ff = $f + $cmd unarchive $ff + echo "'"$ff"'" désarchivé } $argv } edit:add-var listarchiver~ [@argv]{ peach [f]{ - local f = $f - $cmd ls $f + var ff = $f + $cmd ls $ff } $argv } diff --git a/aliases/ipof.elv b/aliases/ipof.elv index d3ebf59..e8c2162 100644 --- a/aliases/ipof.elv +++ b/aliases/ipof.elv @@ -31,9 +31,9 @@ edit:add-var ipof~ [@argv]{ var value = (str:trim-space $l[$idx".."]) if (or (str:has-prefix $l 'IPv4 addresses') (str:has-prefix $l 'IPv6 addresses')) { str:split ', ' $value | peach [e]{ - var e = $e - if (ip:is-ip $e) { - result[ips][$e] = $nil + var ee = $e + if (ip:is-ip $ee) { + result[ips][$ee] = $nil } } } elif (str:has-prefix $l 'TXT records') { @@ -49,28 +49,27 @@ edit:add-var ipof~ [@argv]{ var hosts = [&] cat /etc/hosts | peach [l]{ - var l = $l - l = (str:trim-space $l) - if (and (not-eq $l '') (not-eq $l[0] '#')) { - put $l + var ll = (str:trim-space $l) + if (and (not-eq $ll '') (not-eq $ll[0] '#')) { + put $ll } } | eawk [_ ip @domains]{ peach [d]{ - var d = $d - if (has-key $hosts $d) { - hosts[$d][$ip] = $nil + var dd = $d + if (has-key $hosts $dd) { + hosts[$dd][$ip] = $nil } else { - hosts[$d] = [&$ip=$nil] + hosts[$dd] = [&$ip=$nil] } } $domains } var remote = [&] peach [d]{ - var d = $d - var solve = (dnssolve $d) + var dd = $d + var solve = (dnssolve $dd) if (> (keys $solve[ips] | count) 0) { - remote[$d] = $solve + remote[$dd] = $solve } } $argv diff --git a/lib/moi/util/file.elv b/lib/moi/util/file.elv index 8f23b43..4c7cb2f 100644 --- a/lib/moi/util/file.elv +++ b/lib/moi/util/file.elv @@ -35,10 +35,8 @@ fn -search [&sort=$false &type=exact @motive]{ result = (put * | map:to-set) } else { peach [m]{ - var m = $m try { $f $m | peach [e]{ - var e = $e result[$e] = $nil } } except e { } @@ -52,7 +50,6 @@ fn match-files [&sort=$false &type=prefix @motive]{ -search &sort=$sort &type=$t fn match-extensions [&sort=$false &type=deep-prefix motive @extensions]{ result = [&] -search &type=$type $motive | peach [f]{ - var f = $f if (list:contains [e]{ str:has-suffix $f .$e } $extensions) { result[$f] = $nil } diff --git a/lib/moi/util/list.elv b/lib/moi/util/list.elv index 08a3fc7..a4b7277 100644 --- a/lib/moi/util/list.elv +++ b/lib/moi/util/list.elv @@ -263,7 +263,6 @@ fn remove-duplicate [@argv]{ fn premove-duplicate [@argv]{ var done = [&] peach [v]{ - var v = $v done[$v] = $nil } (-p $@argv) keys $done