mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Merge branch 'master' of git://github.com/aliva/fish-shell into aliva-master
This commit is contained in:
commit
cbcc439e03
2 changed files with 20 additions and 1 deletions
|
@ -7,7 +7,7 @@
|
|||
# Test if completing using package names is appropriate
|
||||
function __fish_yum_package_ok
|
||||
for i in (commandline -poc)
|
||||
if contains $i update upgrade remove erase
|
||||
if contains $i update upgrade remove erase install reinstall
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,6 +22,25 @@ function __fish_print_packages
|
|||
return
|
||||
end
|
||||
|
||||
# yum is slow, just like rpm, so go to the background
|
||||
if type -f /usr/share/yum-cli/completion-helper.py >/dev/null
|
||||
|
||||
# If the cache is less than six hours old, we do not recalculate it
|
||||
|
||||
set cache_file /tmp/.yum-cache.$USER
|
||||
if test -f $cache_file
|
||||
cat $cache_file
|
||||
set age (math (date +%s) - (stat -c '%Y' $cache_file))
|
||||
set max_age 21600
|
||||
if test $age -lt $max_age
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
# Remove package version information from output and pipe into cache file
|
||||
/usr/share/yum-cli/completion-helper.py list all -d 0 -C >$cache_file | cut -d '.' -f 1 | sed '1d' | sed '/^\s/d' | sed -e 's/$/'\t$package'/' &
|
||||
end
|
||||
|
||||
# Rpm is too slow for this job, so we set it up to do completions
|
||||
# as a background job and cache the results.
|
||||
|
||||
|
|
Loading…
Reference in a new issue