mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-04-21 08:51:14 -03:00
@@ -52,6 +52,25 @@ function __fish_print_packages
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Zypper needs caching as it is slow
|
||||||
|
if type -q -f zypper
|
||||||
|
# If the cache is less than five minutes old, we do not recalculate it
|
||||||
|
|
||||||
|
set -l cache_file $XDG_CACHE_HOME/.zypper-cache.$USER
|
||||||
|
if test -f $cache_file
|
||||||
|
cat $cache_file
|
||||||
|
set -l age (math (date +%s) - (stat -c '%Y' $cache_file))
|
||||||
|
set -l max_age 300
|
||||||
|
if test $age -lt $max_age
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Remove package version information from output and pipe into cache file
|
||||||
|
zypper --quiet --non-interactive search --type=package | tail -n +4 | sed -E 's/^. \| ((\w|[-_.])+).*/\1\t'$package'/g' > $cache_file &
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
# yum is slow, just like rpm, so go to the background
|
# yum is slow, just like rpm, so go to the background
|
||||||
if type -q -f /usr/share/yum-cli/completion-helper.py
|
if type -q -f /usr/share/yum-cli/completion-helper.py
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user