mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-28 13:53:10 +00:00
Creating cache for xbps-query in __fish_print_packages.fish (#7534)
* Completions for xbps were not showed on cache file creation * Completions for xbps were not showed on cache file creation, small typo
This commit is contained in:
parent
a2e486966a
commit
0200fc0fbc
1 changed files with 2 additions and 2 deletions
|
@ -253,15 +253,15 @@ function __fish_print_packages
|
||||||
if not set -q only_installed
|
if not set -q only_installed
|
||||||
set -l cache_file $xdg_cache_home/.xbps-cache.$USER
|
set -l cache_file $xdg_cache_home/.xbps-cache.$USER
|
||||||
if test -f $cache_file
|
if test -f $cache_file
|
||||||
cat $cache_file
|
|
||||||
set -l age (math (date +%s) - (stat -c '%Y' $cache_file))
|
set -l age (math (date +%s) - (stat -c '%Y' $cache_file))
|
||||||
set -l max_age 300
|
set -l max_age 300
|
||||||
if test $age -lt $max_age
|
if test $age -lt $max_age
|
||||||
|
cat $cache_file
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# prints: <package name> Package
|
# prints: <package name> Package
|
||||||
xbps-query -Rsl | sed 's/^... \([^ ]*\)-.* .*/\1/; s/$/\t'Package'/' >$cache_file &
|
xbps-query -Rsl | sed 's/^... \([^ ]*\)-.* .*/\1/; s/$/\t'Package'/' | tee $cache_file
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
xbps-query -l | sed 's/^.. \([^ ]*\)-.* .*/\1/' # TODO: actually put package versions in tab for locally installed packages
|
xbps-query -l | sed 's/^.. \([^ ]*\)-.* .*/\1/' # TODO: actually put package versions in tab for locally installed packages
|
||||||
|
|
Loading…
Reference in a new issue