54 lines
919 B
Plaintext
54 lines
919 B
Plaintext
var cmd = $e:arc~
|
|
|
|
edit:add-var archiver~ [@argv]{
|
|
use str
|
|
var help = {
|
|
echo "Usage : archiver [(-zlxgb)] <file to compress>"
|
|
return
|
|
}
|
|
if (or (== (count $argv) 0) (eq $argv[0] -h)) {
|
|
$help
|
|
}
|
|
var format o = zst $argv[0]
|
|
if (and (str:has-prefix $o -) (> (count $o) 1)) {
|
|
set o = $o[1]
|
|
var m = [
|
|
&z=zst
|
|
&l=lz4
|
|
&x=xz
|
|
&g=gz
|
|
&b=bz2
|
|
]
|
|
if (not (has-key $m $o)) {
|
|
$help
|
|
}
|
|
set format argv = $m[$o] $argv[1..]
|
|
}
|
|
if (== (count $argv) 0) {
|
|
$help
|
|
}
|
|
peach [f]{
|
|
var ff = $f
|
|
if (eq $ff[-1] /) {
|
|
set f = $ff[..-1]
|
|
}
|
|
$cmd archive $ff'.tar.'$format $ff
|
|
echo "'"$ff"'" archivé
|
|
} $argv
|
|
}
|
|
|
|
edit:add-var desarchiver~ [@argv]{
|
|
peach [f]{
|
|
var ff = $f
|
|
$cmd unarchive $ff
|
|
echo "'"$ff"'" désarchivé
|
|
} $argv
|
|
}
|
|
|
|
edit:add-var listarchiver~ [@argv]{
|
|
peach [f]{
|
|
var ff = $f
|
|
$cmd ls $ff
|
|
} $argv
|
|
}
|