bin/ex: fix little issues

This commit is contained in:
xeruf 2021-12-02 12:50:18 +01:00
parent fe92ab8fff
commit 68403ad0c1
2 changed files with 20 additions and 17 deletions

View File

@ -3,27 +3,29 @@
# usage: ex <file>
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

View File

@ -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