config/shell/arch: adjustments in helpers

This commit is contained in:
xeruf 2021-09-18 22:02:28 +02:00
parent cab2cb8452
commit c747cdf295
2 changed files with 11 additions and 6 deletions

View File

@ -8,24 +8,26 @@ alias pacs='pac -Syu --needed'
alias pacr='pac -R --recursive' alias pacr='pac -R --recursive'
alias yays='noglob yay -Sy --needed' alias yays='noglob yay -Sy --needed'
alias yayr='noglob yay -R --cascade --recursive' alias yayr='noglob yay -R --cascade --recursive'
alias yau='yay -Syu --sudoloop --nobatchinstall'
yzf() { yzf() {
pos=$1 pos=$1
shift shift
sed "s/ /\t/g" | sed "s/ /\t/g" |
fzf --nth=$pos --multi --history=/var/tmp/fzf-history-yzf$pos \ fzf --nth=$pos --multi --history="${FZF_HISTDIR:-$XDG_STATE_HOME/fzf}/history-yzf$pos" \
--preview-window=60%,border-left \ --preview-window=60%,border-left \
--bind="double-click:execute(xdg-open 'https://archlinux.org/packages/{$pos}')" \ --bind="double-click:execute(xdg-open 'https://archlinux.org/packages/{$pos}'),alt-enter:execute(xdg-open 'https://aur.archlinux.org/packages?K={$pos}&SB=p&SO=d&PP=100')" \
"$@" | cut -f$pos | xargs "$@" | cut -f$pos | xargs
} }
# print -s adds a shell history entry # print -s adds a shell history entry
yas() { yas() {
cache_dir="/tmp/yas" cache_dir="/tmp/yas"
test "$1" = "-y" && rm -r "$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"
pkg=$((cat "$list_cache$@" 2>/dev/null || { pacman --color=always -Sl "$@"; yay --color=always -Sl aur "$@" } | sed 's/ [^ ]*unknown-version[^ ]*//' | tee "$list_cache$@") | pkg=$( (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") 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..."

View File

@ -6,13 +6,16 @@ case $command in
cd "$DATA/2-standards/dev/aur" cd "$DATA/2-standards/dev/aur"
git -c init.defaultBranch=master clone ssh://aur@aur.archlinux.org/$1.git git -c init.defaultBranch=master clone ssh://aur@aur.archlinux.org/$1.git
cd "$1" cd "$1"
echo '*' > .gitignore test -f PKGBUILD || sed "s/PKG/${1%%-git}/" ../PKGBUILD > PKGBUILD
test -f .gitignore || echo '*' > .gitignore
exec $SHELL;; exec $SHELL;;
(create) (create)
git add -f .gitignore PKGBUILD .SRCINFO git add -f .gitignore PKGBUILD
git commit -m "Create package" "$@" git commit -m "Create package" "$@"
git aur push --amend;; git aur push --amend;;
(push) makepkg --printsrcinfo > .SRCINFO (push)
makepkg --printsrcinfo > .SRCINFO
git add -f .SRCINFO
git commit -v -a "$@" git commit -v -a "$@"
git push;; git push;;
esac esac