Update .config/fish/functions/extract.fish
Update .config/fish/functions/pkgsearch.fish
This commit is contained in:
parent
4db69346fd
commit
69eff01fd3
2 changed files with 27 additions and 19 deletions
|
@ -4,38 +4,40 @@
|
||||||
# Usage: extract <file>
|
# Usage: extract <file>
|
||||||
|
|
||||||
function extract -a file
|
function extract -a file
|
||||||
|
set --erase argv[1]
|
||||||
|
|
||||||
if test -f "$file"
|
if test -f "$file"
|
||||||
switch $file
|
switch "$file"
|
||||||
case "*.tar.bz2"
|
case "*.tar.bz2"
|
||||||
tar -jxvf $file
|
tar -jxvf $argv "$file"
|
||||||
case "*.tar.gz"
|
case "*.tar.gz"
|
||||||
tar -zxvf $file
|
tar -zxvf $argv "$file"
|
||||||
case "*.bz2"
|
case "*.bz2"
|
||||||
bunzip2 $file
|
bunzip2 $argv "$file"
|
||||||
case "*.dmg"
|
case "*.dmg"
|
||||||
if test "$(uname)" = Darwin
|
if test "$(uname)" = Darwin
|
||||||
hdiutil mount $file
|
hdiutil mount "$file"
|
||||||
end
|
end
|
||||||
case "*.gz"
|
case "*.gz"
|
||||||
gunzip $file
|
gunzip $argv "$file"
|
||||||
case "*.tar"
|
case "*.tar"
|
||||||
tar -xvf $file
|
tar -xvf $argv "$file"
|
||||||
case "*.tbz2"
|
case "*.tbz2"
|
||||||
tar -jxvf $file
|
tar -jxvf $argv "$file"
|
||||||
case "*.tgz"
|
case "*.tgz"
|
||||||
tar -zxvf $file
|
tar -zxvf $argv "$file"
|
||||||
case "*.zip"
|
case "*.zip" "*.ZIP"
|
||||||
unzip $file
|
set -f dir (string replace --ignore-case '.zip' '')
|
||||||
case "*.ZIP"
|
mkdir "$dir"
|
||||||
unzip $file
|
unzip $argv "$file" -d "$dir"
|
||||||
case "*pax"
|
case "*pax"
|
||||||
cat $file | pax -r
|
cat "$file" | pax -r $argv
|
||||||
case "*.pax.Z"
|
case "*.pax.Z"
|
||||||
uncompress $file --stdout | pax -r
|
uncompress "$file" --stdout | pax -r $argv
|
||||||
case "*.rar"
|
case "*.rar"
|
||||||
unrar x $file
|
unrar x "$file"
|
||||||
case "*.Z"
|
case "*.Z"
|
||||||
uncompress $file
|
uncompress $argv "$file"
|
||||||
case "*"
|
case "*"
|
||||||
echo "'$file' cannot be extracted/mounted via extract()."
|
echo "'$file' cannot be extracted/mounted via extract()."
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
#!/usr/bin/env fish
|
#!/usr/bin/env fish
|
||||||
|
|
||||||
function pkgsearch -d "Search the core/extra/AUR repos for a package"
|
function pkgsearch -d "Search the core/extra/AUR repos for a package" -a search
|
||||||
set -f res (yay -Slq | command fzf --multi --preview 'yay -Si {}' --height=90% --layout=reverse)
|
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
|
if test $status -eq 0
|
||||||
set -l pkgs (string join ' ' $res)
|
set -l pkgs (string join ' ' $res)
|
||||||
|
|
Loading…
Reference in a new issue