Ajout de l’alias trdsql + réutilisation de wget2 + limitation du nombre d’archives créables en simultané (nouveauté Elvish 0.20.x) + utilisation de rg à la place de grep + utilisation du builtin de Elvish (nouveauté Elvish 0.20.x) pour les suppressions/créations de fichiers/répertoires

This commit is contained in:
Benjamin VAUDOUR 2024-03-02 15:15:47 +01:00
parent f98a134d40
commit 817650ded9
7 changed files with 15 additions and 28 deletions

View File

@ -23,4 +23,4 @@ edit:add-var trdsql~ {|@argv| e:trdsql -ih -id ';' -omd $@argv }
#edit:add-var tree~ {|@argv| e:tree -puhC --dirsfirst --du -D $@argv } #edit:add-var tree~ {|@argv| e:tree -puhC --dirsfirst --du -D $@argv }
edit:add-var tree~ $-erd~ edit:add-var tree~ $-erd~
edit:add-var ungron~ {|@argv| e:gron --ungron $@argv } edit:add-var ungron~ {|@argv| e:gron --ungron $@argv }
#edit:add-var wget~ {|@argv| e:wget2 $@argv } edit:add-var wget~ {|@argv| e:wget2 $@argv }

View File

@ -27,7 +27,7 @@ edit:add-var archiver~ {|@argv|
if (== (count $argv) 0) { if (== (count $argv) 0) {
$help $help
} }
peach {|f| peach &num-workers=3 {|f|
var ff = (str:trim-suffix $f '/') var ff = (str:trim-suffix $f '/')
$cmd archive $ff'.tar.'$format $ff $cmd archive $ff'.tar.'$format $ff
printf "'%s' archivé\n" $ff printf "'%s' archivé\n" $ff

View File

@ -1,15 +0,0 @@
edit:add-var maj-carapace~ {||
use path
var cur = (pwd)
var wd = $E:HOME/Documents/OtherGo/github.com/rsteube/carapace-bin
var bd = $E:HOME/Go/bin
cd $wd
git pull
cd cmd/carapace
go generate ./...
go build -ldflags="-s -w" -tags release
if (path:is-regular carapace) {
mv -f carapace $bd
}
cd $cur
}

View File

@ -1 +1 @@
edit:add-var pacmanhisto~ {|@argv| e:cat /var/log/pacman.log | e:grep "ALPM" | e:grep $@argv } edit:add-var pacmanhisto~ {|@argv| e:cat /var/log/pacman.log | e:rg "ALPM" | e:rg $@argv }

View File

@ -1,5 +1,6 @@
edit:add-var pdf~ {|action @args| edit:add-var pdf~ {|action @args|
use math use math
use os
use path use path
use re use re
use str use str
@ -113,7 +114,7 @@ edit:add-var pdf~ {|action @args|
pdf:cat &out=$t $@args pdf:cat &out=$t $@args
pdf:split &size=$s $t $out pdf:split &size=$s $t $out
} finally { } finally {
rm -f $t os:remove-all $t
} }
} }
@ -172,7 +173,7 @@ edit:add-var pdf~ {|action @args|
try { try {
pdf:cat &out=$t $in $@sel pdf:cat &out=$t $in $@sel
var n = (pdf:nb-pages $t) var n = (pdf:nb-pages $t)
mkdir $out os:mkdir $out
range 1 (+ 1 $mod) | each {|m| range 1 (+ 1 $mod) | each {|m|
var sel = (range 1 (+ $n 1) | each {|i| var sel = (range 1 (+ $n 1) | each {|i|
var s = (% $i $mod) var s = (% $i $mod)
@ -182,7 +183,7 @@ edit:add-var pdf~ {|action @args|
pdf:cat &out=(printf '%s/%d.pdf' $out $m) $t $sel pdf:cat &out=(printf '%s/%d.pdf' $out $m) $t $sel
} }
} finally { } finally {
rm -f $t os:remove-all $t
} }
} }
@ -397,14 +398,14 @@ edit:add-var pdf~ {|action @args|
&i=$extract-images~ &i=$extract-images~
] ]
try { try {
mkdir $out os:mkdir $out
str:split ',' $types | each {|t| str:split ',' $types | each {|t|
set t = (str:to-lower $t) set t = (str:to-lower $t)
must-valid $t {|e| and (> (count $e) 0) (has-key $extr $e[0])} must-valid $t {|e| and (> (count $e) 0) (has-key $extr $e[0])}
$extr[$t[0]] $in $out $extr[$t[0]] $in $out
} }
} catch e { } catch e {
rm -rf $out os:remove-all $out
fail $e fail $e
} }
} }

View File

@ -1,8 +1,9 @@
edit:add-var winmail~ {|@argv| edit:add-var winmail~ {|@argv|
use path use path
use os
var curdir = (pwd) var curdir = (pwd)
var tmpdir = (mktemp --tmpdir -d winmail-XXXXXXXX) var tmpdir = (os:temp-dir 'winmail-*')
var remove = $false var remove = $false
var browse = $e:falkon~ var browse = $e:falkon~
var explore = $e:dolphin~ var explore = $e:dolphin~
@ -36,14 +37,14 @@ edit:add-var winmail~ {|@argv|
set data = (path:abs 'winmail.dat') set data = (path:abs 'winmail.dat')
} }
if (not (path:is-regular $data)) { if (not (os:is-regular $data)) {
fail (printf 'Le fichier %s nexiste pas.' $data) fail (printf 'Le fichier %s nexiste pas.' $data)
} }
cd $tmpdir cd $tmpdir
tnef --save-body $data tnef --save-body $data
if (path:is-regular message.html) { if (os:is-regular message.html) {
perl -pe 's/cid:(image(\\d{3})\.(jpe?g|png|gif))@[[:alnum:]]{8}\.[[:alnum:]]{8}/\\1/g' message.html > message2.html perl -pe 's/cid:(image(\\d{3})\.(jpe?g|png|gif))@[[:alnum:]]{8}\.[[:alnum:]]{8}/\\1/g' message.html > message2.html
$browse message2.html > /dev/null 2> /dev/null $browse message2.html > /dev/null 2> /dev/null
} else { } else {
@ -51,8 +52,8 @@ edit:add-var winmail~ {|@argv|
} }
cd $curdir cd $curdir
rm -rf $tmpdir os:remove-all $tmpdir
if $remove { if $remove {
rm $data os:remove $data
} }
} }