diff --git a/CHANGELOG.md b/CHANGELOG.md index 08d3ead98..da0bc3665 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -163,6 +163,7 @@ Xcode builds and macOS packages could not be produced with 2.7b1, but this is fi - `apt` - `cd` (#4061) - `composer` (#4295) + - `eopkg` - `flatpak` (#4456) - `git` (#4117, #4147, #4329, #4368) - `gphoto2` diff --git a/share/completions/eopkg.fish b/share/completions/eopkg.fish index b3a9b3ae4..2fe1aeb02 100644 --- a/share/completions/eopkg.fish +++ b/share/completions/eopkg.fish @@ -39,7 +39,8 @@ end # Setup additional completion complete -f -c eopkg -n '__fish_seen_subcommand_from remove-repo rr enable-repo er disable-repo dr list-available la' -a "(__fish_eopkg_print_repos)" -d "Repository" -complete -f -c eopkg -n '__fish_seen_subcommand_from upgrade up remove rm autoremove rmf install it info check' -a "(__fish_print_packages)" -d "Package" +complete -f -c eopkg -n '__fish_seen_subcommand_from upgrade up install it info' -a "(__fish_print_packages)" -d "Available Package" +complete -f -c eopkg -n '__fish_seen_subcommand_from remove rm autoremove rmf check' -a "(__fish_print_packages --installed)" -d "Installed Package" complete -f -c eopkg -n '__fish_seen_subcommand_from upgrade up remove rm install it info check list-available la list-installed li list-upgrades lu' -s c -l component -a "(__fish_eopkg_print_components)" -d "Component" # Setup eopkg subcommand with shortcut diff --git a/share/functions/__fish_print_packages.fish b/share/functions/__fish_print_packages.fish index 43ef0d9c7..6ff33a6ee 100644 --- a/share/functions/__fish_print_packages.fish +++ b/share/functions/__fish_print_packages.fish @@ -145,20 +145,37 @@ function __fish_print_packages if type -q -f eopkg # If the cache is less than max_age, we do not recalculate it + # Determine whether to print installed/available packages - set cache_file $XDG_CACHE_HOME/.eopkg-cache.$USER - if test -f $cache_file - cat $cache_file - set age (math (date +%s) - (stat -c '%Y' $cache_file)) - set max_age 500 - if test $age -lt $max_age - return + if set -q only_installed + set cache_file $XDG_CACHE_HOME/.eopkg-installed-cache.$USER + if test -f $cache_file + cat $cache_file + set age (math (date +%s) - (stat -c '%Y' $cache_file)) + set max_age 500 + if test $age -lt $max_age + return + end end - end - # Remove package version information from output and pipe into cache file - eopkg list-available -N | cut -d ' ' -f 1 >$cache_file & - return + # Remove package version information from output and pipe into cache file + eopkg list-installed -N | cut -d ' ' -f 1 >$cache_file & + return + else + set cache_file $XDG_CACHE_HOME/.eopkg-available-cache.$USER + if test -f $cache_file + cat $cache_file + set age (math (date +%s) - (stat -c '%Y' $cache_file)) + set max_age 500 + if test $age -lt $max_age + return + end + end + + # Remove package version information from output and pipe into cache file + eopkg list-available -N | cut -d ' ' -f 1 >$cache_file & + return + end end # This completes the package name from the portage tree.