mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Optimize structure/layout of __fish_print_packages
Move XDG_CACHE_HOME logic below package providers that don't use the cache.
This commit is contained in:
parent
1c4940c04c
commit
4b78c92652
1 changed files with 8 additions and 6 deletions
|
@ -12,12 +12,6 @@ function __fish_print_packages
|
||||||
#Get the word 'Package' in the current language
|
#Get the word 'Package' in the current language
|
||||||
set -l package (_ "Package")
|
set -l package (_ "Package")
|
||||||
|
|
||||||
# Set up cache directory
|
|
||||||
if test -z "$XDG_CACHE_HOME"
|
|
||||||
set XDG_CACHE_HOME $HOME/.cache
|
|
||||||
end
|
|
||||||
mkdir -m 700 -p $XDG_CACHE_HOME
|
|
||||||
|
|
||||||
if type -q -f apt-cache
|
if type -q -f apt-cache
|
||||||
# Do not generate the cache as apparently sometimes this is slow.
|
# Do not generate the cache as apparently sometimes this is slow.
|
||||||
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=547550
|
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=547550
|
||||||
|
@ -42,6 +36,14 @@ function __fish_print_packages
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
### BEGIN CACHED RESULTS ###
|
||||||
|
|
||||||
|
# Set up cache directory
|
||||||
|
if test -z "$XDG_CACHE_HOME"
|
||||||
|
set XDG_CACHE_HOME $HOME/.cache
|
||||||
|
end
|
||||||
|
mkdir -m 700 -p $XDG_CACHE_HOME
|
||||||
|
|
||||||
# Caches for 5 minutes
|
# Caches for 5 minutes
|
||||||
if type -q -f pacman
|
if type -q -f pacman
|
||||||
set cache_file $XDG_CACHE_HOME/.pac-cache.$USER
|
set cache_file $XDG_CACHE_HOME/.pac-cache.$USER
|
||||||
|
|
Loading…
Reference in a new issue