config/shell/arch: indent with tabs and use star-args for yas

This commit is contained in:
xeruf 2021-12-10 16:01:21 +01:00
parent 77fd546800
commit f32325d02b
2 changed files with 34 additions and 29 deletions

View File

@ -27,10 +27,14 @@ yas() {
test "$1" = "-y" && rm -rf "$cache_dir" && shift test "$1" = "-y" && rm -rf "$cache_dir" && shift
mkdir -p "$cache_dir" mkdir -p "$cache_dir"
preview_cache="$cache_dir/preview_{2}" preview_cache="$cache_dir/preview_{2}"
list_cache="$cache_dir/list" list_cache="$cache_dir/list$*"
{ test "$(cat "$list_cache$@" | wc -l)" -lt 50000 && rm "$list_cache$@"; } 2>/dev/null { test "$(cat "$list_cache" | wc -l)" -lt 50000 && rm "$list_cache"; } 2>/dev/null
pkg=$( (cat "$list_cache$@" 2>/dev/null || { pacman --color=always -Sl "$@"; yay --color=always -Sl aur "$@" } | sed 's/ [^ ]*unknown-version[^ ]*//' | tee "$list_cache$@") | pkg=$(
yzf 2 --tiebreak=index --preview="cat $preview_cache 2>/dev/null | grep -v 'Querying' | grep . || yay --color always -Si {2} | tee $preview_cache") ( cat "$list_cache" 2>/dev/null ||
{ pacman --color=always -Sl "$@"; yay --color=always -Sl aur "$@" } |
sed 's/ [^ ]*unknown-version[^ ]*//' | tee "$list_cache" ) |
yzf 2 --tiebreak=index --preview="cat $preview_cache 2>/dev/null | grep -v 'Querying' | grep . || yay --color always -Si {2} | tee $preview_cache"
)
if test -n "$pkg" if test -n "$pkg"
then echo "Installing $pkg..." then echo "Installing $pkg..."
cmd="yay -S $pkg" cmd="yay -S $pkg"

View File

@ -1,6 +1,7 @@
#!/bin/sh #!/bin/sh
{ {
echo "$# Args: $@" echo "$# Args: $@"
#echo "Starred: $*"
#echo "${@:-default}" | sed 's/\w\+/\0-w/g' #echo "${@:-default}" | sed 's/\w\+/\0-w/g'
for last; do true; done for last; do true; done
echo "Last arg: $last" echo "Last arg: $last"