Move fish's pacman functions to separate scripts

master
Pierre Neidhardt 2017-06-17 10:59:25 +01:00
parent 272a0e32f6
commit 079a67357a
5 changed files with 27 additions and 11 deletions

View File

@ -1,9 +1,6 @@
set -l listinstalled "(pacman -Q | string replace ' ' \t)"
set -l listall "(__fish_print_packages)"
function pacfiles -d 'List of files in pacman package packages sorted by size'
pacman -Qlq $argv | grep -v '/$' | xargs du -cbh | sort -h
end
complete -c pacfiles -a "$listinstalled"
function pacls -d 'List/open package files with fzf'
@ -13,8 +10,3 @@ function pacls -d 'List/open package files with fzf'
[ "$result" ]; and commandline -- $result
end
complete -c pacls -a "$listinstalled"
function paclog -a size -d 'Pacman last installed packages'
[ $size ]; or set size 30
expac -t '%F %T' '%-8l %n' | sort -rn | head -$size
end

View File

@ -51,7 +51,6 @@
;;;
;;; `eshell/alias' is too slow as it reads and write the file on each definition.
;;; Let's write manually instead.
;;; TODO: Add pacman functions from fish config.
(with-eval-after-load 'em-alias
(eshell-read-aliases-list)
(dolist

13
.scripts/pacfiles Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
if [ "$1" = "-h" ]; then
cat <<EOF>&2
Usage: ${0##*/} [PACKAGES]
List of files in pacman packages sorted by size
EOF
exit
fi
pacman -Qlq "$@" | grep -v '/$' | xargs du -cbh | sort -h

14
.scripts/pachist Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
if [ "$1" = "-h" ]; then
cat <<EOF>&2
Usage: ${0##*/} [COUNT]
List pacman's COUNT last installed packages
EOF
exit
fi
[ -z "$1" ] && set -- 30
expac -t '%F %T' '%-8l %n' | sort -rn | head -$1

View File

@ -179,5 +179,3 @@ fi
buffer=$(LC_ALL=C pacman -Qi "$@" 2>&1 1>&3 3>&- | cut -f2 -d "'")
[ -n "$buffer" ] && LC_ALL=C pacman -Si "$buffer"
} 3>&1 | filter | { $opt_sort || remove_duplicates ;} | { $opt_total || cat ;}
# vim: set noet: