Update .config/fish/functions/extract.fish

Update .config/fish/functions/pkgsearch.fish
This commit is contained in:
punkfairie 2024-09-30 18:16:13 -07:00
parent 4db69346fd
commit 69eff01fd3
Signed by: punkfairie
GPG key ID: A86AF57F837E320F
2 changed files with 27 additions and 19 deletions

View file

@ -4,38 +4,40 @@
# Usage: extract <file>
function extract -a file
set --erase argv[1]
if test -f "$file"
switch $file
switch "$file"
case "*.tar.bz2"
tar -jxvf $file
tar -jxvf $argv "$file"
case "*.tar.gz"
tar -zxvf $file
tar -zxvf $argv "$file"
case "*.bz2"
bunzip2 $file
bunzip2 $argv "$file"
case "*.dmg"
if test "$(uname)" = Darwin
hdiutil mount $file
hdiutil mount "$file"
end
case "*.gz"
gunzip $file
gunzip $argv "$file"
case "*.tar"
tar -xvf $file
tar -xvf $argv "$file"
case "*.tbz2"
tar -jxvf $file
tar -jxvf $argv "$file"
case "*.tgz"
tar -zxvf $file
case "*.zip"
unzip $file
case "*.ZIP"
unzip $file
tar -zxvf $argv "$file"
case "*.zip" "*.ZIP"
set -f dir (string replace --ignore-case '.zip' '')
mkdir "$dir"
unzip $argv "$file" -d "$dir"
case "*pax"
cat $file | pax -r
cat "$file" | pax -r $argv
case "*.pax.Z"
uncompress $file --stdout | pax -r
uncompress "$file" --stdout | pax -r $argv
case "*.rar"
unrar x $file
unrar x "$file"
case "*.Z"
uncompress $file
uncompress $argv "$file"
case "*"
echo "'$file' cannot be extracted/mounted via extract()."
end

View file

@ -1,7 +1,13 @@
#!/usr/bin/env fish
function pkgsearch -d "Search the core/extra/AUR repos for a package"
set -f res (yay -Slq | command fzf --multi --preview 'yay -Si {}' --height=90% --layout=reverse)
function pkgsearch -d "Search the core/extra/AUR repos for a package" -a search
set -f query ""
if set -q search
set query "--query $search"
end
set -f res (yay -Slq | command fzf --multi --preview 'yay -Si {}' --height=90% --layout=reverse "$query")
if test $status -eq 0
set -l pkgs (string join ' ' $res)