diff options
author | 2024-03-25 16:43:09 +0530 | |
---|---|---|
committer | 2024-03-25 16:43:09 +0530 | |
commit | a62114c91f2070c8c8453d117f3d81dc113e41ff (patch) | |
tree | f266e87af29a08c01f82bc32dd7d463d8ec4441a /zsh/oh-my-zsh/plugins/universalarchive/universalarchive.plugin.zsh | |
parent | af120ab348f2e1a5a39dec035ed9dcf84189a64e (diff) | |
download | dotfiles-a62114c91f2070c8c8453d117f3d81dc113e41ff.tar.gz dotfiles-a62114c91f2070c8c8453d117f3d81dc113e41ff.tar.bz2 dotfiles-a62114c91f2070c8c8453d117f3d81dc113e41ff.zip |
dotfile update
Diffstat (limited to 'zsh/oh-my-zsh/plugins/universalarchive/universalarchive.plugin.zsh')
-rw-r--r-- | zsh/oh-my-zsh/plugins/universalarchive/universalarchive.plugin.zsh | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/zsh/oh-my-zsh/plugins/universalarchive/universalarchive.plugin.zsh b/zsh/oh-my-zsh/plugins/universalarchive/universalarchive.plugin.zsh deleted file mode 100644 index b287c22..0000000 --- a/zsh/oh-my-zsh/plugins/universalarchive/universalarchive.plugin.zsh +++ /dev/null @@ -1,70 +0,0 @@ -function ua() { - local usage=\ -"Archive files and directories using a given compression algorithm. - -Usage: $0 <format> <files> -Example: $0 tbz PKGBUILD - -Supported archive formats are: -7z, bz2, gz, lzma, lzo, rar, tar, tbz (tar.bz2), tgz (tar.gz), -tlz (tar.lzma), txz (tar.xz), tZ (tar.Z), xz, Z, zip, and zst." - - if [[ $# -lt 2 ]]; then - print -u2 -- "$usage" - return 1 - fi - - local ext="$1" - local input="${2:a}" - - shift - - if [[ ! -e "$input" ]]; then - print -u2 -- "$input not found" - return 1 - fi - - # generate output file name - local output - if [[ $# -gt 1 ]]; then - output="${input:h:t}" - elif [[ -f "$input" ]]; then - output="${input:r:t}" - elif [[ -d "$input" ]]; then - output="${input:t}" - fi - - # if output file exists, generate a random name - if [[ -f "${output}.${ext}" ]]; then - output=$(mktemp "${output}_XXX") && rm "$output" || return 1 - fi - - # add extension - output="${output}.${ext}" - - # safety check - if [[ -f "$output" ]]; then - print -u2 -- "output file '$output' already exists. Aborting" - return 1 - fi - - case "$ext" in - 7z) 7z u "${output}" "${@}" ;; - bz2) bzip2 -vcf "${@}" > "${output}" ;; - gz) gzip -vcf "${@}" > "${output}" ;; - lzma) lzma -vc -T0 "${@}" > "${output}" ;; - lzo) lzop -vc "${@}" > "${output}" ;; - rar) rar a "${output}" "${@}" ;; - tar) tar -cvf "${output}" "${@}" ;; - tbz|tar.bz2) tar -cvjf "${output}" "${@}" ;; - tgz|tar.gz) tar -cvzf "${output}" "${@}" ;; - tlz|tar.lzma) XZ_OPT=-T0 tar --lzma -cvf "${output}" "${@}" ;; - txz|tar.xz) XZ_OPT=-T0 tar -cvJf "${output}" "${@}" ;; - tZ|tar.Z) tar -cvZf "${output}" "${@}" ;; - xz) xz -vc -T0 "${@}" > "${output}" ;; - Z) compress -vcf "${@}" > "${output}" ;; - zip) zip -rull "${output}" "${@}" ;; - zst) zstd -c -T0 "${@}" > "${output}" ;; - *) print -u2 -- "$usage"; return 1 ;; - esac -} |