From 68403ad0c171ebfca343665edfead0ec40ba267c Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Thu, 2 Dec 2021 12:50:18 +0100 Subject: [PATCH] bin/ex: fix little issues --- .local/bin/scripts/ex | 34 ++++++++++++++++++---------------- README.org | 3 ++- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/.local/bin/scripts/ex b/.local/bin/scripts/ex index cbc8e24..9973b3d 100755 --- a/.local/bin/scripts/ex +++ b/.local/bin/scripts/ex @@ -3,27 +3,29 @@ # usage: ex for arg do if test -r "$arg"; then - arg="$(realpath "$arg")" - name="$(basename "${arg%.*}")" + path="$(realpath "$arg")" + name="$(basename "${path%.*}")" + ( if test "$(ls -U | wc -l)" -gt 2; then - mkdir "$name" + mkdir -p "$name" cd "$name" fi + echo "Extracting $arg into $PWD" case "$arg" in - *.tar.bz2) tar xjf "$arg" ;; - *.tar.*|*.tar) tar --extract --file "$arg";; - *.bz2) bunzip2 "$arg" ;; - *.rar) unrar x "$arg" ;; - *.gz) gunzip "$arg" ;; - *.tbz2) tar xjf "$arg" ;; - *.tgz) tar xzf "$arg" ;; - *.zip|*.jar) unzip "$arg" ;; - *.Z) uncompress "$arg";; - *.7z) 7z x "$arg" ;; - *.deb) ar x "$arg" ;; - *.zst) unzstd "$arg" ;; - *) echo "'$arg' cannot be extracted by ex" ;; + (*.tar.*|*.tar) tar --extract --file "$path";; + (*.tbz2) tar xjf "$path" ;; + (*.tgz) tar xzf "$path" ;; + (*.zip|*.jar) unzip "$path" | rewrite ;; + (*.gz) gunzip "$path" ;; + (*.bz2) bunzip2 "$path" ;; + (*.rar) unrar x "$path" ;; + (*.7z|*.z01) 7z x "$path" ;; + (*.deb) ar x "$path" ;; + (*.zst) unzstd "$path" ;; + (*.Z) uncompress "$path";; + (*) echo "'$arg' cannot be extracted by ex" >&2;; esac + ) else echo "'$1' is not a readable file" fi diff --git a/README.org b/README.org index fd87aa2..4fb64ce 100644 --- a/README.org +++ b/README.org @@ -30,7 +30,7 @@ and configuration for ~less~ and ~fzf~. : pacman -Qe | cut -d\ -f1 | xclip -selection clipboard # Use org-yank-visible - essentials :: git zsh bat neovim man-db -- basic tools :: texinfo fd ripgrep tree jrnl python-pynvim wget zsh-completions mlocate (locate on deb) +- basic tools :: texinfo fd ripgrep tree jrnl python-pynvim wget zsh-completions unrar mlocate (locate on deb) - common tools :: topgrade ffmpeg imagemagick pandoc [[https://lftp.yar.ru/][lftp]] glances youtube-dl dos2unix zsh-doc pacman-contrib espanso - pass :: pass pass-otp pass-extension-tail pass-clip -> interesting: pass-steam, pass-autotype, pass-file, pass-qr, pass-ssh, pass-rotate @@ -41,6 +41,7 @@ and configuration for ~less~ and ~fzf~. - aur recommendations :: tldr++ sc-im - git tools :: git-bug git-lfs git-crypt git-remote-gcrypt github-cli - personal aur utils (need configuration) :: [[https://github.com/mookid/diffr][diffr]] bat-extras-git rdictcc-git neovim-symlinks stderred-git + : pip install beautifulsoup4 - experiments :: kakoune ** Applications - productivity :: activitywatch-bin