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:
Vadim Zyamalov 2020-12-08 22:59:56 +03:00 committed by GitHub
parent a2e486966a
commit 0200fc0fbc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -253,15 +253,15 @@ function __fish_print_packages
if not set -q only_installed
set -l cache_file $xdg_cache_home/.xbps-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
cat $cache_file
return
end
end
# 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
else
xbps-query -l | sed 's/^.. \([^ ]*\)-.* .*/\1/' # TODO: actually put package versions in tab for locally installed packages