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> # usage: ex <file>
for arg do for arg do
if test -r "$arg"; then if test -r "$arg"; then
arg="$(realpath "$arg")" path="$(realpath "$arg")"
name="$(basename "${arg%.*}")" name="$(basename "${path%.*}")"
(
if test "$(ls -U | wc -l)" -gt 2; then if test "$(ls -U | wc -l)" -gt 2; then
mkdir "$name" mkdir -p "$name"
cd "$name" cd "$name"
fi fi
echo "Extracting $arg into $PWD"
case "$arg" in case "$arg" in
*.tar.bz2) tar xjf "$arg" ;; (*.tar.*|*.tar) tar --extract --file "$path";;
*.tar.*|*.tar) tar --extract --file "$arg";; (*.tbz2) tar xjf "$path" ;;
*.bz2) bunzip2 "$arg" ;; (*.tgz) tar xzf "$path" ;;
*.rar) unrar x "$arg" ;; (*.zip|*.jar) unzip "$path" | rewrite ;;
*.gz) gunzip "$arg" ;; (*.gz) gunzip "$path" ;;
*.tbz2) tar xjf "$arg" ;; (*.bz2) bunzip2 "$path" ;;
*.tgz) tar xzf "$arg" ;; (*.rar) unrar x "$path" ;;
*.zip|*.jar) unzip "$arg" ;; (*.7z|*.z01) 7z x "$path" ;;
*.Z) uncompress "$arg";; (*.deb) ar x "$path" ;;
*.7z) 7z x "$arg" ;; (*.zst) unzstd "$path" ;;
*.deb) ar x "$arg" ;; (*.Z) uncompress "$path";;
*.zst) unzstd "$arg" ;; (*) echo "'$arg' cannot be extracted by ex" >&2;;
*) echo "'$arg' cannot be extracted by ex" ;;
esac esac
)
else else
echo "'$1' is not a readable file" echo "'$1' is not a readable file"
fi fi

View File

@ -30,7 +30,7 @@ and configuration for ~less~ and ~fzf~.
: pacman -Qe | cut -d\ -f1 | xclip -selection clipboard : pacman -Qe | cut -d\ -f1 | xclip -selection clipboard
# Use org-yank-visible # Use org-yank-visible
- essentials :: git zsh bat neovim man-db - 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 - 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 - pass :: pass pass-otp pass-extension-tail pass-clip
-> interesting: pass-steam, pass-autotype, pass-file, pass-qr, pass-ssh, pass-rotate -> 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 - aur recommendations :: tldr++ sc-im
- git tools :: git-bug git-lfs git-crypt git-remote-gcrypt github-cli - 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 - 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 - experiments :: kakoune
** Applications ** Applications
- productivity :: activitywatch-bin - productivity :: activitywatch-bin