diff --git a/sh/_lsarchive b/sh/_lsarchive index f2cee88..bcbfbd6 100755 --- a/sh/_lsarchive +++ b/sh/_lsarchive @@ -10,4 +10,4 @@ _arguments \ '(-v --verbose)'{-v,--remove}'[verbose archive listing]' \ - "*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|jar|rar|7z)(-.)'" && return 0 + "*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|zst|jar|rar|7z)(-.)'" && return 0 diff --git a/sh/_unarchive b/sh/_unarchive index 90e32f1..6a940b1 100755 --- a/sh/_unarchive +++ b/sh/_unarchive @@ -10,4 +10,4 @@ _arguments \ '(-r --remove)'{-r,--remove}'[remove archive]' \ - "*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|jar|rar|7z|deb)(-.)'" && return 0 + "*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|zst|jar|rar|7z|deb)(-.)'" && return 0 diff --git a/sh/archive b/sh/archive index 10bbad3..b6f9523 100755 --- a/sh/archive +++ b/sh/archive @@ -1,4 +1,3 @@ -#!/usr/bin/env zsh # # Creates archive file # @@ -8,7 +7,7 @@ # function archive { -local archive_name path_to_archive _gzip_bin _bzip2_bin _xz_bin +local archive_name path_to_archive _gzip_bin _bzip2_bin _xz_bin _zstd_bin if (( $# < 2 )); then cat >&2 < 0 )); do (*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \ && tar --lzma -t${verbose:+v}f "$1" \ || lzcat "$1" | tar x${verbose:+v}f - ;; + (*.tar.zst|*.tzst) tar -I zstd -t${verbose:+v}f "$1" ;; (*.tar) tar t${verbose:+v}f "$1" ;; (*.zip|*.jar) unzip -l${verbose:+v} "$1" ;; (*.rar) ( (( $+commands[unrar] )) \ diff --git a/sh/unarchive b/sh/unarchive index 9e38a80..66c7e35 100755 --- a/sh/unarchive +++ b/sh/unarchive @@ -12,7 +12,7 @@ local success local file_name local file_path local extract_dir -local _gzip_bin _bzip2_bin _xz_bin +local _gzip_bin _bzip2_bin _xz_bin _zstd_bin if (( $# == 0 )); then cat >&2 < 0 )); do if [[ ! -s "$1" ]]; then print "$0: file not valid: $1" >&2 @@ -72,6 +74,7 @@ while (( $# > 0 )); do (*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \ && tar --lzma -xvf "$1" \ || lzcat "$1" | tar -xvf - ;; + (*.tar.zst|*.tzst) tar -xvf "$1" --use-compress-program="${_zstd_bin}" ;; (*.tar) tar -xvf "$1" ;; (*.gz) gunzip "$1" ;; (*.bz2) bunzip2 "$1" ;;