Last active
November 10, 2022 11:00
-
-
Save shellexy/0d1f7f2cd8da8f66b42f4f91c7358792 to your computer and use it in GitHub Desktop.
在 msys2 bash 里用类似 apt 的命令代替直接用记不住参数用法的 pacman
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# fix the poorly designed pacman/pacman command | |
# 可以把本文保存在 /usr/local/bin/apt-pacman 并加上可执行权限 | |
list()( | |
set -x | |
pacman -Sl "$@" | |
) | |
search()( | |
set -x | |
pacman -Ss "$@" | |
) | |
show()( | |
set -x | |
pacman -Si "$@" | |
) | |
showfiles()( | |
set -x | |
pacman -Fl "$@" || pacman -Ql "$@" | |
) | |
show-upgradable()( | |
set -x | |
pacman -Qu | |
) | |
install()( | |
set -x | |
pacman -S "$@" | |
) | |
remove()( | |
set -x | |
pacman -Rus "$@" | |
) | |
update()( | |
set -x | |
pacman -Sy "$@" && pacman -Fy "$@" | |
) | |
upgrade()( | |
set -x | |
pacman -Syu "$@" && pacman -Fy "%@" | |
) | |
upgradeable()( | |
set -x | |
pacman -Pu | |
) | |
files()( | |
set -x | |
pacman -F "$@" || pacman -Fy "$@" | |
) | |
autoclean()( | |
set -x | |
pacman -Sc | |
) | |
status()( | |
set -x | |
pacman -Ps | |
) | |
help(){ | |
echo commands: | |
declare -F | grep -oP ' [a-z]+.*' | sort | |
} | |
if [ "$(type -t $1)" = function ] ; then | |
"$@" | |
else | |
help | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment