diff --git a/dot_config/fish/functions/extract.fish b/dot_config/fish/functions/extract.fish index 288349d..c51c0af 100644 --- a/dot_config/fish/functions/extract.fish +++ b/dot_config/fish/functions/extract.fish @@ -4,38 +4,40 @@ # Usage: extract 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 diff --git a/dot_config/fish/functions/pkgsearch.fish b/dot_config/fish/functions/pkgsearch.fish index dd6930e..cd98557 100644 --- a/dot_config/fish/functions/pkgsearch.fish +++ b/dot_config/fish/functions/pkgsearch.fish @@ -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)