mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-19 21:41:07 +01:00
feat(archlinux): optimize paclist
and pacdisowned
(#11398)
Co-authored-by: ratijas <me@ratijas.tk>
This commit is contained in:
parent
ec369bb38e
commit
5901f30b44
2 changed files with 13 additions and 11 deletions
|
@ -181,3 +181,4 @@ whether the package manager is installed, checked in the following order:
|
|||
- Ybalrid (Arthur Brainville) - ybalrid@ybalrid.info
|
||||
- Jeff M. Hubbard - jeffmhubbard@gmail.com
|
||||
- K. Harishankar(harishnkr) - hari2menon1234@gmail.com
|
||||
- WH-2099 - wh2099@outlook.com
|
|
@ -25,27 +25,28 @@ alias pacown='pacman -Qo'
|
|||
alias pacupd="sudo pacman -Sy"
|
||||
|
||||
function paclist() {
|
||||
# Based on https://bbs.archlinux.org/viewtopic.php?id=93683
|
||||
pacman -Qqe | \
|
||||
xargs -I '{}' \
|
||||
expac "${bold_color}% 20n ${fg_no_bold[white]}%d${reset_color}" '{}'
|
||||
local pkgs=$(LC_ALL=C pacman -Qqe)
|
||||
for pkg in ${(f)pkgs}; do
|
||||
pacman -Qs --color=auto "^${pkg}\$" || break
|
||||
done
|
||||
}
|
||||
|
||||
function pacdisowned() {
|
||||
local tmp db fs
|
||||
tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
|
||||
db=$tmp/db
|
||||
fs=$tmp/fs
|
||||
local tmp_dir db fs
|
||||
tmp_dir=$(mktemp --directory)
|
||||
db=$tmp_dir/db
|
||||
fs=$tmp_dir/fs
|
||||
|
||||
mkdir "$tmp"
|
||||
trap 'rm -rf "$tmp"' EXIT
|
||||
trap "rm -rf $tmp_dir" EXIT
|
||||
|
||||
pacman -Qlq | sort -u > "$db"
|
||||
|
||||
find /bin /etc /lib /sbin /usr ! -name lost+found \
|
||||
find /etc /usr ! -name lost+found \
|
||||
\( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
|
||||
|
||||
comm -23 "$fs" "$db"
|
||||
|
||||
rm -rf $tmp_dir
|
||||
}
|
||||
|
||||
alias pacmanallkeys='sudo pacman-key --refresh-keys'
|
||||
|
|
Loading…
Reference in a new issue