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
|
- Ybalrid (Arthur Brainville) - ybalrid@ybalrid.info
|
||||||
- Jeff M. Hubbard - jeffmhubbard@gmail.com
|
- Jeff M. Hubbard - jeffmhubbard@gmail.com
|
||||||
- K. Harishankar(harishnkr) - hari2menon1234@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"
|
alias pacupd="sudo pacman -Sy"
|
||||||
|
|
||||||
function paclist() {
|
function paclist() {
|
||||||
# Based on https://bbs.archlinux.org/viewtopic.php?id=93683
|
local pkgs=$(LC_ALL=C pacman -Qqe)
|
||||||
pacman -Qqe | \
|
for pkg in ${(f)pkgs}; do
|
||||||
xargs -I '{}' \
|
pacman -Qs --color=auto "^${pkg}\$" || break
|
||||||
expac "${bold_color}% 20n ${fg_no_bold[white]}%d${reset_color}" '{}'
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function pacdisowned() {
|
function pacdisowned() {
|
||||||
local tmp db fs
|
local tmp_dir db fs
|
||||||
tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
|
tmp_dir=$(mktemp --directory)
|
||||||
db=$tmp/db
|
db=$tmp_dir/db
|
||||||
fs=$tmp/fs
|
fs=$tmp_dir/fs
|
||||||
|
|
||||||
mkdir "$tmp"
|
trap "rm -rf $tmp_dir" EXIT
|
||||||
trap 'rm -rf "$tmp"' EXIT
|
|
||||||
|
|
||||||
pacman -Qlq | sort -u > "$db"
|
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"
|
\( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
|
||||||
|
|
||||||
comm -23 "$fs" "$db"
|
comm -23 "$fs" "$db"
|
||||||
|
|
||||||
|
rm -rf $tmp_dir
|
||||||
}
|
}
|
||||||
|
|
||||||
alias pacmanallkeys='sudo pacman-key --refresh-keys'
|
alias pacmanallkeys='sudo pacman-key --refresh-keys'
|
||||||
|
|
Loading…
Reference in a new issue