From 4d4cfc287e9d887b81242c0e431b5f49f9cec5c1 Mon Sep 17 00:00:00 2001 From: ca0904 Date: Tue, 29 Sep 2026 21:08:41 +0530 Subject: [PATCH] fix(universalarchive): support `7zz` and `7z` for 7z archives (#14147) --- plugins/universalarchive/README.md | 2 +- plugins/universalarchive/universalarchive.plugin.zsh | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/plugins/universalarchive/README.md b/plugins/universalarchive/README.md index bcd33cea0..55e1ac2bc 100644 --- a/plugins/universalarchive/README.md +++ b/plugins/universalarchive/README.md @@ -52,7 +52,7 @@ The plugin will generate a default archive filename based on the input: | Format | Description | Tool Used | |:-----------------|:-------------------------------|:-----------------| -| `7z` | 7zip archive | `7z` | +| `7z` | 7zip archive | `7zz`,`7z`,`7za` | | `bz2` | Bzip2-compressed file | `bzip2` | | `gz` | Gzip-compressed file | `gzip` | | `lzma` | LZMA-compressed file | `lzma` | diff --git a/plugins/universalarchive/universalarchive.plugin.zsh b/plugins/universalarchive/universalarchive.plugin.zsh index b287c22b2..3d4968bde 100644 --- a/plugins/universalarchive/universalarchive.plugin.zsh +++ b/plugins/universalarchive/universalarchive.plugin.zsh @@ -49,7 +49,17 @@ tlz (tar.lzma), txz (tar.xz), tZ (tar.Z), xz, Z, zip, and zst." fi case "$ext" in - 7z) 7z u "${output}" "${@}" ;; + 7z) + if (( $+commands[7zz] )); then + 7zz u "${output}" "${@}" + elif (( $+commands[7z] )); then + 7z u "${output}" "${@}" + elif (( $+commands[7za] )); then + 7za u "${output}" "${@}" + else + echo "ua: cannot create 7z files: install 7zz, 7z or 7za" >&2 + return 1 + fi ;; bz2) bzip2 -vcf "${@}" > "${output}" ;; gz) gzip -vcf "${@}" > "${output}" ;; lzma) lzma -vc -T0 "${@}" > "${output}" ;;