From 714aa92a9596352d4f70e35d212fe922c23348b4 Mon Sep 17 00:00:00 2001 From: krisdoodle45 <86745210+krisdoodle45@users.noreply.github.com> Date: Wed, 20 Oct 2021 16:27:40 +0200 Subject: [PATCH] ext: Remove in favor of atool (#1013) * ext: Give the ability to extract multiple files and wildcards * Variable renaming * Make user get prompted if extracted file overwrites another file * Deleted ext We have atool * Replace ext with aunpack --- .config/lf/lfrc | 2 +- .local/bin/ext | 45 --------------------------------------------- 2 files changed, 1 insertion(+), 46 deletions(-) delete mode 100755 .local/bin/ext diff --git a/.config/lf/lfrc b/.config/lf/lfrc index 4101338..9ec6830 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -36,7 +36,7 @@ cmd extract ${{ printf "%s\n\t" "$fx" printf "extract?[y/N]" read ans - [ $ans = "y" ] && ext $fx + [ $ans = "y" ] && aunpack $fx }} cmd delete ${{ diff --git a/.local/bin/ext b/.local/bin/ext deleted file mode 100755 index 6950ff6..0000000 --- a/.local/bin/ext +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh - -# A general, all-purpose extraction script. Not all extraction programs here -# are installed by LARBS automatically. -# -# Default behavior: Extract archive into new directory -# Behavior with `-c` option: Extract contents into current directory - -while getopts "hc" o; do case "${o}" in - c) extracthere="True" ;; - *) printf "Options:\\n -c: Extract archive into current directory rather than a new one.\\n" && exit 1 ;; -esac done - -if [ -z "$extracthere" ]; then - archive="$(readlink -f "$*")" && - directory="$(echo "$archive" | sed 's/\.[^\/.]*$//')" && - mkdir -p "$directory" && - cd "$directory" || exit 1 -else - archive="$(readlink -f "$(echo "$*" | cut -d' ' -f2)" 2>/dev/null)" -fi - -[ -z "$archive" ] && printf "Give archive to extract as argument.\\n" && exit 1 - -if [ -f "$archive" ] ; then - case "$archive" in - *.tar.bz2|*.tbz2) bsdtar -xf "$archive" ;; - *.tar.xz) bsdtar -xf "$archive" ;; - *.tar.gz|*.tgz) bsdtar -xf "$archive" ;; - *.tar.zst) bsdtar -xf "$archive" ;; - *.tar) bsdtar -xf "$archive" ;; - *.lzma) unlzma "$archive" ;; - *.bz2) bunzip2 "$archive" ;; - *.rar) unrar x -ad "$archive" ;; - *.gz) gunzip "$archive" ;; - *.zip) unzip "$archive" ;; - *.Z) uncompress "$archive" ;; - *.7z) 7z x "$archive" ;; - *.xz) unxz "$archive" ;; - *.exe) cabextract "$archive" ;; - *) printf "extract: '%s' - unknown archive method\\n" "$archive" ;; - esac -else - printf "File \"%s\" not found.\\n" "$archive" -fi