mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-19 16:52:46 +08:00
Improve Arch Linux package completions
Add completions for `downgrade` tool Add new `--installed` option for printing Arch packages Change Arch Linux package related completions to use `--installed` add newline
This commit is contained in:
parent
0f681190ba
commit
266ce7c940
3
share/completions/downgrade.fish
Normal file
3
share/completions/downgrade.fish
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Arch Linux package downgrader tool
|
||||
complete -c downgrade -f
|
||||
complete -c downgrade -xa "(__fish_print_packages --installed)"
|
|
@ -1,7 +1,7 @@
|
|||
set -l progname pacaur
|
||||
complete -c $progname -f
|
||||
|
||||
set -l listinstalled "(pacman -Q | string replace ' ' \t)"
|
||||
set -l listinstalled "(__fish_print_packages --installed)"
|
||||
# This might be an issue if another package manager is also installed (e.g. for containers)
|
||||
set -l listall "(__fish_print_packages)"
|
||||
set -l listrepos "(__fish_print_pacman_repos)"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
set -l progname pacman
|
||||
|
||||
set -l listinstalled "(pacman -Q | string replace ' ' \t)"
|
||||
set -l listinstalled "(__fish_print_packages --installed)"
|
||||
# This might be an issue if another package manager is also installed (e.g. for containers)
|
||||
set -l listall "(__fish_print_packages)"
|
||||
set -l listrepos "(__fish_print_pacman_repos)"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
set -l progname yaourt
|
||||
complete -c $progname -f
|
||||
|
||||
set -l listinstalled "(pacman -Q | string replace ' ' \t)"
|
||||
set -l listinstalled "(__fish_print_packages --installed)"
|
||||
# This might be an issue if another package manager is also installed (e.g. for containers)
|
||||
set -l listall "(__fish_print_packages)"
|
||||
set -l listrepos "(__fish_print_pacman_repos)"
|
||||
|
|
|
@ -60,19 +60,23 @@ function __fish_print_packages
|
|||
|
||||
# Caches for 5 minutes
|
||||
if type -q -f pacman
|
||||
set cache_file $XDG_CACHE_HOME/.pac-cache.$USER
|
||||
if test -f $cache_file
|
||||
cat $cache_file
|
||||
set age (math (date +%s) - (stat -c '%Y' $cache_file))
|
||||
set max_age 250
|
||||
if test $age -lt $max_age
|
||||
return
|
||||
if not set -q only_installed
|
||||
set cache_file $XDG_CACHE_HOME/.pac-cache.$USER
|
||||
if test -f $cache_file
|
||||
cat $cache_file
|
||||
set age (math (date +%s) - (stat -c '%Y' $cache_file))
|
||||
set max_age 250
|
||||
if test $age -lt $max_age
|
||||
return
|
||||
end
|
||||
end
|
||||
# prints: <package name> Package
|
||||
pacman -Ssq | sed -e 's/$/\t'Package'/' >$cache_file &
|
||||
return
|
||||
else
|
||||
pacman -Q | string replace ' ' \t
|
||||
return
|
||||
end
|
||||
|
||||
# prints: <package name> Package
|
||||
pacman -Ssq | sed -e 's/$/\t'Package'/' >$cache_file &
|
||||
return
|
||||
end
|
||||
|
||||
# Zypper needs caching as it is slow
|
||||
|
|
Loading…
Reference in New Issue
Block a user