diff --git a/share/completions/apk.fish b/share/completions/apk.fish index 51fa65563..6a6d204f8 100644 --- a/share/completions/apk.fish +++ b/share/completions/apk.fish @@ -1,8 +1,8 @@ # Completions for apk (Alpine Package Keeper) # Package name -complete -f -c apk -n "__fish_seen_subcommand_from add info fetch dot" -a "(__fish_print_packages)" -d Package -complete -f -c apk -n "__fish_seen_subcommand_from del fix version manifest" -a "(__fish_print_packages --installed)" -d Package +complete -f -c apk -n "__fish_seen_subcommand_from add info fetch dot" -a "(apk search -q)" -d Package +complete -f -c apk -n "__fish_seen_subcommand_from del fix version manifest" -a "(apk info -q)" -d Package # Global options complete -f -c apk -s h -l help -d "Show help" diff --git a/share/completions/apt-cache.fish b/share/completions/apt-cache.fish index 67c2f6479..2e44de37d 100644 --- a/share/completions/apt-cache.fish +++ b/share/completions/apt-cache.fish @@ -38,4 +38,4 @@ function __fish_apt-cache_use_package -d 'Test if apt command should have packag return 1 end -complete -c apt-cache -n __fish_apt-cache_use_package -a '(__fish_print_packages)' -d Package +complete -c apt-cache -n __fish_apt-cache_use_package -a '(__fish_print_apt_packages)' -d Package diff --git a/share/completions/apt-get.fish b/share/completions/apt-get.fish index abf4ddc73..790e7a1c6 100644 --- a/share/completions/apt-get.fish +++ b/share/completions/apt-get.fish @@ -18,7 +18,7 @@ function __fish_apt_use_package -d 'Test if apt command should have packages as return 1 end -complete -c apt-get -n __fish_apt_use_package -a '(__fish_print_packages)' -d Package +complete -c apt-get -n __fish_apt_use_package -a '(__fish_print_apt_packages)' -d Package complete -c apt-get -s h -l help -d 'Display help and exit' complete -f -n __fish_apt_no_subcommand -c apt-get -a update -d 'Update sources' diff --git a/share/completions/apt-mark.fish b/share/completions/apt-mark.fish index 942b3f5a2..48b4da6d9 100644 --- a/share/completions/apt-mark.fish +++ b/share/completions/apt-mark.fish @@ -18,7 +18,7 @@ function __fish_apt_use_package -d 'Test if apt command should have packages as return 1 end -complete -c apt-mark -n __fish_apt_use_package -a '(__fish_print_packages)' -d Package +complete -c apt-mark -n __fish_apt_use_package -a '(__fish_print_apt_packages)' -d Package complete -c apt-mark -s h -l help -d 'Display help and exit' complete -f -n __fish_apt_no_subcommand -c apt-mark -a auto -d 'Mark a package as automatically installed' diff --git a/share/completions/apt.fish b/share/completions/apt.fish index cb2e05e23..c195edd79 100644 --- a/share/completions/apt.fish +++ b/share/completions/apt.fish @@ -27,8 +27,8 @@ end complete -c apt -f -complete -k -c apt -n "__fish_seen_subcommand_from $pkg_subcmds" -a '(__fish_print_packages | head -n 250 | sort)' -complete -c apt -n "__fish_seen_subcommand_from $installed_pkg_subcmds" -a '(__fish_print_packages --installed | string match -re -- "(?:\\b|_)"(commandline -ct | string escape --style=regex) | head -n 250)' -d Package +complete -k -c apt -n "__fish_seen_subcommand_from $pkg_subcmds" -a '(__fish_print_apt_packages | head -n 250 | sort)' +complete -c apt -n "__fish_seen_subcommand_from $installed_pkg_subcmds" -a '(__fish_print_apt_packages --installed | string match -re -- "(?:\\b|_)"(commandline -ct | string escape --style=regex) | head -n 250)' -d Package complete -k -c apt -n "__fish_seen_subcommand_from $handle_file_pkg_subcmds" -a '(__fish_complete_suffix .deb)' complete -c apt -n "__fish_seen_subcommand_from install" -l no-install-recommends diff --git a/share/completions/aptitude.fish b/share/completions/aptitude.fish index d14f118e7..956c3ec05 100644 --- a/share/completions/aptitude.fish +++ b/share/completions/aptitude.fish @@ -18,7 +18,7 @@ function __fish_apt_use_package -d 'Test if aptitude command should have package return 1 end -complete -c aptitude -n __fish_apt_use_package -a '(__fish_print_packages)' -d Package +complete -c aptitude -n __fish_apt_use_package -a '(__fish_print_apt_packages)' -d Package complete -c aptitude -s h -l help -d 'Display a brief help message. Identical to the help action' complete -f -n __fish_apt_no_subcommand -c aptitude -a autoclean -d 'Remove any cached packages which can no longer be downloaded' diff --git a/share/completions/aura.fish b/share/completions/aura.fish index 72169e8c1..b74358787 100644 --- a/share/completions/aura.fish +++ b/share/completions/aura.fish @@ -1,7 +1,7 @@ # This can't currently be wrapped as the pacman completions rely on variables whose value this needs to change # complete -c aura -w pacman set -l listinstalled "(pacman -Q | tr ' ' \t)" -set -l listall "(__fish_print_packages)" +set -l listall "(__fish_print_pacman_packages)" set -l listrepos "(__fish_print_pacman_repos)" set -l listgroups "(pacman -Sg | sed 's/\(.*\)/\1\tPackage group/g')" diff --git a/share/completions/dlocate.fish b/share/completions/dlocate.fish index af5daceeb..20840c2e3 100644 --- a/share/completions/dlocate.fish +++ b/share/completions/dlocate.fish @@ -1,5 +1,5 @@ complete -c dlocate -s S -x -d 'List records that match filenames' -complete -c dlocate -s L -d 'List all files in the package' -xa '(__fish_print_packages)' -complete -c dlocate -o ls -d 'ls -ldF all files in the package' -xa '(__fish_print_packages)' -complete -c dlocate -o du -d 'du -sck all files in the package' -xa '(__fish_print_packages)' +complete -c dlocate -s L -d 'List all files in the package' -xa '(__fish_print_apt_packages)' +complete -c dlocate -o ls -d 'ls -ldF all files in the package' -xa '(__fish_print_apt_packages)' +complete -c dlocate -o du -d 'du -sck all files in the package' -xa '(__fish_print_apt_packages)' diff --git a/share/completions/downgrade.fish b/share/completions/downgrade.fish index 35575c166..f21ed2aec 100644 --- a/share/completions/downgrade.fish +++ b/share/completions/downgrade.fish @@ -1,3 +1,3 @@ # Arch Linux package downgrader tool complete -c downgrade -f -complete -c downgrade -xa "(__fish_print_packages --installed)" +complete -c downgrade -xa "(__fish_print_pacman_packages --installed)" diff --git a/share/completions/dpkg-reconfigure.fish b/share/completions/dpkg-reconfigure.fish index c58267121..a96f287a6 100644 --- a/share/completions/dpkg-reconfigure.fish +++ b/share/completions/dpkg-reconfigure.fish @@ -1,6 +1,6 @@ # Completions for the `dpkg-reconfigure` command -complete -f -c dpkg-reconfigure -a '(__fish_print_packages)' -d Package +complete -f -c dpkg-reconfigure -a '(__fish_print_apt_packages)' -d Package # Support flags complete -x -f -c dpkg-reconfigure -s h -l help -d 'Display help' diff --git a/share/completions/eopkg.fish b/share/completions/eopkg.fish index d7cd0e927..715960070 100644 --- a/share/completions/eopkg.fish +++ b/share/completions/eopkg.fish @@ -33,8 +33,8 @@ function __fish_eopkg_print_repos -d "Print list of repositories" end 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 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 install it info' -a "(__fish_print_eopkg_packages)" -d "Available Package" +complete -f -c eopkg -n '__fish_seen_subcommand_from remove rm autoremove rmf check' -a "(__fish_print_eopkg_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 ## Upgrade diff --git a/share/completions/opkg.fish b/share/completions/opkg.fish index a9fa787b6..6a62c5153 100644 --- a/share/completions/opkg.fish +++ b/share/completions/opkg.fish @@ -27,9 +27,9 @@ function __fish_opkg_use_package_installed -d 'Test if opkg command should have return 1 end -complete -c opkg -n __fish_opkg_use_package -a '(__fish_print_packages)' -d Package +complete -c opkg -n __fish_opkg_use_package -a '(__fish_print_opkg_packages)' -d Package -complete -c opkg -n __fish_opkg_use_package_installed -a '(__fish_print_packages --installed)' -d Package +complete -c opkg -n __fish_opkg_use_package_installed -a '(__fish_print_opkg_packages --installed)' -d Package complete -f -n __fish_opkg_no_subcommand -c opkg -a update -d 'Update list of available packages' complete -f -n __fish_opkg_no_subcommand -c opkg -a upgrade -d 'Upgrade packages' diff --git a/share/completions/pacaur.fish b/share/completions/pacaur.fish index 707158ab7..f1a0710c7 100644 --- a/share/completions/pacaur.fish +++ b/share/completions/pacaur.fish @@ -1,9 +1,9 @@ set -l progname pacaur complete -c $progname -f -set -l listinstalled "(__fish_print_packages --installed)" +set -l listinstalled "(__fish_print_pacman_packages --installed)" # This might be an issue if another package manager is also installed (e.g. for containers) -set -l listall "(__fish_print_packages)" +set -l listall "(__fish_print_pacman_packages)" set -l listrepos "(__fish_print_pacman_repos)" set -l listgroups "(pacman -Sg)\t'Package Group'" diff --git a/share/completions/pacman.fish b/share/completions/pacman.fish index 465b56adc..20c51da5f 100644 --- a/share/completions/pacman.fish +++ b/share/completions/pacman.fish @@ -4,9 +4,9 @@ set -l progname pacman -set -l listinstalled "(__fish_print_packages --installed)" +set -l listinstalled "(__fish_print_pacman_packages --installed)" # This might be an issue if another package manager is also installed (e.g. for containers) -set -l listall "(__fish_print_packages)" +set -l listall "(__fish_print_pacman_packages)" set -l listrepos "(__fish_print_pacman_repos)" set -l listgroups "(pacman -Sg)\t'Package Group'" diff --git a/share/completions/pkg_delete.fish b/share/completions/pkg_delete.fish index d8a8bda11..31de6bfb7 100644 --- a/share/completions/pkg_delete.fish +++ b/share/completions/pkg_delete.fish @@ -1,3 +1,3 @@ -complete -c pkg_delete -a '(__fish_print_packages)' -d Package +complete -c pkg_delete -a '(__fish_print_pkg_add_packages)' -d Package complete -c pkg_delete -o a -d 'Delete unused deps' complete -c pkg_delete -o V -d 'Turn on stats' diff --git a/share/completions/pkg_info.fish b/share/completions/pkg_info.fish index a51e95e12..dbb616eff 100644 --- a/share/completions/pkg_info.fish +++ b/share/completions/pkg_info.fish @@ -1 +1 @@ -complete -c pkg_info -a '(__fish_print_packages)' -d Package +complete -c pkg_info -a '(__fish_print_pkg_add_packages)' -d Package diff --git a/share/completions/port.fish b/share/completions/port.fish index dfee5a5cd..6196c3251 100644 --- a/share/completions/port.fish +++ b/share/completions/port.fish @@ -8,7 +8,7 @@ set -l subcommands activate archive build cat cd checksum clean configure \ selfupdate setrequested setunrequested sync test unarchive uninstall \ unload unsetrequested upgrade url usage variants version work -complete -c port -n "__fish_seen_subcommand_from $subcommands" -a '(__fish_print_packages)' -d Package +complete -c port -n "__fish_seen_subcommand_from $subcommands" -a '(__fish_print_port_packages)' -d Package complete -f -n "__fish_use_subcommand $subcommands" -c port -a activate -d 'Set version of a port to active' complete -f -n "__fish_use_subcommand $subcommands" -c port -a archive -d "Create image for port without installing" diff --git a/share/completions/portmaster.fish b/share/completions/portmaster.fish index 916ac5e79..437a1e715 100644 --- a/share/completions/portmaster.fish +++ b/share/completions/portmaster.fish @@ -51,4 +51,4 @@ complete -c portmaster -f -d 'Ports Directory' -a " string match -r '(?<=/usr/ports/)[^/]*(?:/[^/]*)?' (__fish_complete_directories /usr/ports/(commandline -ct)) )" -complete -c portmaster -f -d 'Installed package' -a "(__fish_print_packages)" +complete -c portmaster -f -d 'Installed package' -a "(__fish_print_port_packages)" diff --git a/share/completions/rpm.fish b/share/completions/rpm.fish index 53d2f4b18..9bb26c6ee 100644 --- a/share/completions/rpm.fish +++ b/share/completions/rpm.fish @@ -71,7 +71,7 @@ complete $rpm_query -l triggers -d 'Display the trigger scripts contained in the complete $rpm_query -l triggerscripts -d 'Display the trigger scripts contained in the package' set -l rpm_select -c rpm -n "__fish_contains_opt -s q -s V query verify" -complete $rpm_select -a "(__fish_print_packages)" +complete $rpm_select -a "(__fish_print_rpm_packages)" complete $rpm_select -s a -l all -d 'Query all installed packages' complete $rpm_select -s f -l file -d 'Query package owning specified file' -rF complete $rpm_select -l fileid -d 'Query package that contains a given file identifier, i.e. the MD5 digest of the file contents' -x @@ -81,7 +81,7 @@ complete $rpm_select -s p -l package -d 'Query an (uninstalled) package in speci complete $rpm_select -l pkgid -d 'Query package that contains a given package identifier, i.e. the MD5 digest of the combined header and payload contents' -x complete $rpm_select -l specfile -d 'Parse and query specified spec-file as if it were a package' -xa "(__fish_complete_suffix .spec)" complete $rpm_select -l tid -d 'Query package(s) that have the specified TID (transaction identifier)' -x -complete $rpm_select -l triggeredby -d 'Query packages that are triggered by the specified packages' -x -a "(__fish_print_packages)" +complete $rpm_select -l triggeredby -d 'Query packages that are triggered by the specified packages' -x -a "(__fish_print_rpm_packages)" complete $rpm_select -l whatprovides -d 'Query all packages that provide the specified capability' -x complete $rpm_select -l whatrequires -d 'Query all packages that requires the specified capability for functioning' -x @@ -101,7 +101,7 @@ complete $rpm_verify -l nomode -d "Don't verify mode attribute" complete $rpm_verify -l nordev -d "Don't verify dev attribute" set -l rpm_erase -c rpm -n "__fish_contains_opt -s e erase" -complete $rpm_erase -a "(__fish_print_packages)" +complete $rpm_erase -a "(__fish_print_rpm_packages)" complete $rpm_erase -l allmatches -d 'Remove all versions of the package which match specified string' complete $rpm_erase -l nodeps -d "Don't check dependencies before uninstalling the packages" complete $rpm_erase -l noscripts -d "Don't execute scriplets" diff --git a/share/completions/snap.fish b/share/completions/snap.fish index beb253413..db99c9950 100644 --- a/share/completions/snap.fish +++ b/share/completions/snap.fish @@ -110,9 +110,6 @@ function __fish_snap_filters -d 'List assertion filters' snap known $argv[1] | string match -v 'type:*' | string match '*: *' | string replace -r '(.*): (.*)' '$1=$2' end -# Enable when __fish_print_packages supports snaps -#complete -c snap -n '__fish_snap_use_package' -a '(__fish_print_packages)' -d 'Package' - # Enable file completions where appropriate complete -c snap -n __fish_snap_use_file -a '(__fish_complete_path)' diff --git a/share/completions/wajig.fish b/share/completions/wajig.fish index b1772e319..c76ec61b0 100644 --- a/share/completions/wajig.fish +++ b/share/completions/wajig.fish @@ -35,7 +35,7 @@ function __fish_wajig_use_package -d 'Test if wajig command should have packages return 1 end -complete -c wajig -n __fish_wajig_use_package -a '(__fish_print_packages)' -d Packageh +complete -c wajig -n __fish_wajig_use_package -a '(__fish_print_apt_packages)' -d Packages complete -c wajig -s q -l quiet -d 'Do system commands everything quietly.' complete -c wajig -s n -l noauth -d 'Allow packages from unathenticated archives.' complete -c wajig -s s -l simulate -d 'Trace but don\'t execute the sequence of underlying commands.' diff --git a/share/completions/xbps-alternatives.fish b/share/completions/xbps-alternatives.fish index 3f2bcb6dd..4487ac16f 100644 --- a/share/completions/xbps-alternatives.fish +++ b/share/completions/xbps-alternatives.fish @@ -3,7 +3,7 @@ set -l progname xbps-alternatives -set -l listinstalled "(__fish_print_packages -i)" +set -l listinstalled "(__fish_print_xbps_packages -i)" complete -c $progname -f complete -c $progname -a "$listinstalled" diff --git a/share/completions/xbps-dgraph.fish b/share/completions/xbps-dgraph.fish index b56fb270a..fd5fe3a8a 100644 --- a/share/completions/xbps-dgraph.fish +++ b/share/completions/xbps-dgraph.fish @@ -4,8 +4,8 @@ set -l progname xbps-dgraph complete -c $progname -f -complete -c $progname -a "(__fish_print_packages -i)" -complete -c $progname -n "__fish_contains_opt -s R" -a "(__fish_print_packages)" +complete -c $progname -a "(__fish_print_xbps_packages -i)" +complete -c $progname -n "__fish_contains_opt -s R" -a "(__fish_print_xbps_packages)" complete -c $progname -s C -d 'Specifies a path to the XBPS configuration directory.' -xa "(__fish_complete_directories)" complete -c $progname -s c -d 'Specifies a path to the graph configuration file.' -F diff --git a/share/completions/xbps-fbulk.fish b/share/completions/xbps-fbulk.fish index b58cd54d9..81a980b67 100644 --- a/share/completions/xbps-fbulk.fish +++ b/share/completions/xbps-fbulk.fish @@ -3,7 +3,7 @@ set -l progname xbps-fbulk -complete -c $progname -f -a "(__fish_complete_directories) (__fish_print_packages)" +complete -c $progname -f -a "(__fish_complete_directories) (__fish_print_xbps_packages)" complete -c $progname -s a -d 'Set a different target architecture, useful for cross compiling.' -x complete -c $progname -s j -d 'Set number of parallel builds running at the same time. By default set to 1.' -x diff --git a/share/completions/xbps-install.fish b/share/completions/xbps-install.fish index 9a81a56f9..c5aae839d 100644 --- a/share/completions/xbps-install.fish +++ b/share/completions/xbps-install.fish @@ -3,7 +3,7 @@ set -l progname xbps-install -set -l listall "(__fish_print_packages)" +set -l listall "(__fish_print_xbps_packages)" complete -c $progname -f complete -c $progname -a "$listall" diff --git a/share/completions/xbps-pkgdb.fish b/share/completions/xbps-pkgdb.fish index 1115aaea4..d84fd2302 100644 --- a/share/completions/xbps-pkgdb.fish +++ b/share/completions/xbps-pkgdb.fish @@ -11,7 +11,7 @@ complete -c $progname -s C -d 'Specifies a path to the XBPS configuration direct complete -c $progname -s d -d 'Enables extra debugging shown to stderr.' complete -c $progname -s h -d 'Show the help message.' complete -c $progname -s m -d 'Set mode of PKGNAME' -xa "$modes" -complete -c $progname -n "__fish_seen_subcommand_from $modes" -xa "(__fish_print_packages -i)" +complete -c $progname -n "__fish_seen_subcommand_from $modes" -xa "(__fish_print_xbps_packages -i)" complete -c $progname -s r -d 'Specifies a full path for the target root directory.' -xa "(__fish_complete_directories)" complete -c $progname -s u -d 'Updates the pkgdb format to the latest version making the necessary conversions.' complete -c $progname -s v -d 'Enables verbose messages.' diff --git a/share/completions/xbps-query.fish b/share/completions/xbps-query.fish index 1f2e7471b..3238ef779 100644 --- a/share/completions/xbps-query.fish +++ b/share/completions/xbps-query.fish @@ -3,8 +3,8 @@ set -l progname xbps-query -set -l listall "(__fish_print_packages)" -set -l listinstalled "(__fish_print_packages -i)" +set -l listall "(__fish_print_xbps_packages)" +set -l listinstalled "(__fish_print_xbps_packages -i)" complete -c $progname -f diff --git a/share/completions/xbps-reconfigure.fish b/share/completions/xbps-reconfigure.fish index 8d2661f21..dc94a9f14 100644 --- a/share/completions/xbps-reconfigure.fish +++ b/share/completions/xbps-reconfigure.fish @@ -3,7 +3,7 @@ set -l progname xbps-reconfigure -set -l listinstalled "(__fish_print_packages -i)" +set -l listinstalled "(__fish_print_xbps_packages -i)" complete -c $progname -f complete -c $progname -a "$listinstalled" diff --git a/share/completions/xbps-remove.fish b/share/completions/xbps-remove.fish index ce34b9f75..0e200e876 100644 --- a/share/completions/xbps-remove.fish +++ b/share/completions/xbps-remove.fish @@ -3,7 +3,7 @@ set -l progname xbps-remove -set -l listinstalled "(__fish_print_packages -i)" +set -l listinstalled "(__fish_print_xbps_packages -i)" complete -c $progname -f complete -c $progname -a "$listinstalled" diff --git a/share/completions/xbps-uhelper.fish b/share/completions/xbps-uhelper.fish index d66936fee..3b41784f1 100644 --- a/share/completions/xbps-uhelper.fish +++ b/share/completions/xbps-uhelper.fish @@ -4,7 +4,7 @@ set -l progname xbps-uhelper set -l actions binpkgarch binpkgver cmpver getpkgdepname getpkgdepversion getpkgname getpkgrevision getpkgversion pkgmatch version real-version -complete -c $progname -f -a "$actions (__fish_print_packages -i)" +complete -c $progname -f -a "$actions (__fish_print_xbps_packages -i)" complete -c $progname -s C -d 'Path to xbps.conf file.' -rF complete -c $progname -s d -d 'Debugging messages to stderr.' diff --git a/share/completions/yaourt.fish b/share/completions/yaourt.fish index dad66c98d..ebfef0d7b 100644 --- a/share/completions/yaourt.fish +++ b/share/completions/yaourt.fish @@ -1,9 +1,9 @@ set -l progname yaourt complete -c $progname -f -set -l listinstalled "(__fish_print_packages --installed)" +set -l listinstalled "(__fish_print_pacman_packages --installed)" # This might be an issue if another package manager is also installed (e.g. for containers) -set -l listall "(__fish_print_packages)" +set -l listall "(__fish_print_pacman_packages)" set -l listrepos "(__fish_print_pacman_repos)" set -l listgroups "(pacman -Sg)\t'Package Group'" diff --git a/share/completions/yum.fish b/share/completions/yum.fish index a0ad88890..dbcde68f2 100644 --- a/share/completions/yum.fish +++ b/share/completions/yum.fish @@ -25,7 +25,7 @@ complete -c yum -n __fish_use_subcommand -xa search -d "find packages matching d complete -c yum -n __fish_use_subcommand -xa clean -d "Clean up cache directory" complete -c yum -n __fish_use_subcommand -xa generate-rss -d "Generate rss changelog" -complete -c yum -n __fish_yum_package_ok -a "(__fish_print_packages)" +complete -c yum -n __fish_yum_package_ok -a "(__fish_print_rpm_packages)" complete -c yum -s h -l help -d "Display help and exit" complete -c yum -s y -d "Assume yes to all questions" @@ -41,7 +41,7 @@ complete -c yum -l enablerepo -d "Enable repository" -r complete -c yum -l disablerepo -d "Disable repository" -r complete -c yum -l obsoletes -d "Enables obsolets processing logic" complete -c yum -l rss-filename -d "Output rss-data to file" -r -complete -c yum -l exclude -d "Exclude specified package from updates" -a "(__fish_print_packages)" +complete -c yum -l exclude -d "Exclude specified package from updates" -a "(__fish_print_rpm_packages)" complete -c yum -n 'contains list (commandline -poc)' -a all -d 'List all packages' complete -c yum -n 'contains list (commandline -poc)' -a available -d 'List packages available for installation' diff --git a/share/functions/__fish_print_apt_packages.fish b/share/functions/__fish_print_apt_packages.fish index a9b03a8f5..a582c8c67 100644 --- a/share/functions/__fish_print_apt_packages.fish +++ b/share/functions/__fish_print_apt_packages.fish @@ -2,18 +2,13 @@ function __fish_print_apt_packages argparse --name=__fish_print_packages i/installed -- $argv or return - set -l only_installed 1 - if not set -q _flag_installed - set -e only_installed - end - switch (commandline -ct) case '-**' return end type -q -f apt-cache || return 1 - if not set -q only_installed + if not set -q _flag_installed # Do not generate the cache as apparently sometimes this is slow. # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=547550 # (It is safe to use `sed -r` here as we are guaranteed to be on a GNU platform diff --git a/share/functions/__fish_print_eopkg_packages.fish b/share/functions/__fish_print_eopkg_packages.fish new file mode 100644 index 000000000..19ff348d2 --- /dev/null +++ b/share/functions/__fish_print_eopkg_packages.fish @@ -0,0 +1,43 @@ +function __fish_print_eopkg_packages + type -q -f eopkg || return 1 + + argparse i/installed -- $argv + or return 1 + + set -l xdg_cache_home (__fish_make_cache_dir) + or return + + # If the cache is less than max_age, we do not recalculate it + # Determine whether to print installed/available packages + + if set -q _flag_installed + set -l cache_file $xdg_cache_home/.eopkg-installed-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 500 + if test $age -lt $max_age + return 0 + end + end + + # Remove package version information from output and pipe into cache file + eopkg list-installed -N | cut -d ' ' -f 1 >$cache_file & + return 0 + else + set -l cache_file $xdg_cache_home/.eopkg-available-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 500 + if test $age -lt $max_age + return 0 + end + end + + # Remove package version information from output and pipe into cache file + eopkg list-available -N | cut -d ' ' -f 1 >$cache_file & + return 0 + end + return 1 +end diff --git a/share/functions/__fish_print_opkg_packages.fish b/share/functions/__fish_print_opkg_packages.fish new file mode 100644 index 000000000..8ef525b9c --- /dev/null +++ b/share/functions/__fish_print_opkg_packages.fish @@ -0,0 +1,14 @@ +function __fish_print_opkg_packages + type -q -f opkg || return 1 + + argparse i/installed -- $argv + or return 1 + + if set -q _flag_installed + opkg list-installed 2>/dev/null | sed -r 's/^([a-zA-Z0-9\-]+) - ([a-zA-Z0-9\-]+)/\1\t\2/g' + return 0 + else + opkg list 2>/dev/null | sed -r 's/^([a-zA-Z0-9\-]+) - ([a-zA-Z0-9\-]+)/\1\t\2/g' + return 0 + end +end diff --git a/share/functions/__fish_print_packages.fish b/share/functions/__fish_print_packages.fish index 2d2092b1e..4d3bbdb7c 100644 --- a/share/functions/__fish_print_packages.fish +++ b/share/functions/__fish_print_packages.fish @@ -1,196 +1,32 @@ -# Use --installed to limit to installed packages only function __fish_print_packages - set -l args $argv - argparse --name=__fish_print_packages i/installed -- $argv - or return - - set -l only_installed 1 - if not set -q _flag_installed - set -e only_installed - end - - switch (commandline -ct) - case '-**' - return - end - - __fish_print_apt_packages $args + # This is `__fish_print_packages`. It prints packages, + # from the first package manager it finds. + # That's a pretty bad idea, which is why this is broken up, + # and only available for legacy reasons. + __fish_print_apt_packages $argv and return - __fish_print_pkg_packages $args + __fish_print_pkg_packages $argv and return - __fish_print_pkg_add_packages $args + __fish_print_pkg_add_packages $argv and return - ### BEGIN CACHED RESULTS ### - - __fish_print_pacman_packages $args + __fish_print_pacman_packages $argv and return - __fish_print_zypper_packages + __fish_print_rpm_packages $argv and return - # Set up cache directory - set -l xdg_cache_home (__fish_make_cache_dir) - or return + __fish_print_eopkg_packages $argv + and return - # yum is slow, just like rpm, so go to the background - if type -q -f /usr/share/yum-cli/completion-helper.py + __fish_print_portage_packages $argv + and return - # If the cache is less than six hours old, we do not recalculate it - - set -l cache_file $xdg_cache_home/.yum-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 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 | sed "s/\..*/\tPackage/" >$cache_file & - return - end - - # Rpm is too slow for this job, so we set it up to do completions - # as a background job and cache the results. - - if type -q -f rpm - - # If the cache is less than five minutes old, we do not recalculate it - - set -l cache_file $xdg_cache_home/.rpm-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 250 - if test $age -lt $max_age - return - end - end - - # Remove package version information from output and pipe into cache file - rpm -qa | sed -e 's/-[^-]*-[^-]*$/\t'Package'/' >$cache_file & - return - end - - # Eopkg is slow in showing list of available 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 - - if set -q only_installed - set -l cache_file $xdg_cache_home/.eopkg-installed-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 500 - if test $age -lt $max_age - return - end - end - - # Remove package version information from output and pipe into cache file - eopkg list-installed -N | cut -d ' ' -f 1 >$cache_file & - return - else - set -l cache_file $xdg_cache_home/.eopkg-available-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 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. - # True for installing new packages. Function for printing - # installed on the system packages is in completions/emerge.fish - - # eix is MUCH faster than emerge so use it if it is available - if type -q -f eix - eix --only-names "^"(commandline -ct) | cut -d/ -f2 - return - else - # FIXME? Seems to be broken - if type -q -f emerge - emerge -s \^(commandline -ct) | string match -r "^\*.*" | cut -d' ' -f3 | cut -d/ -f2 - return - end - end - - # port needs caching, as it tends to be slow - # BSD find is used for determining file age because HFS+ and APFS - # don't save unix time, but the actual date. Also BSD stat is vastly - # different from linux stat and converting its time format is tedious - if type -q -f port - set -l cache_file $xdg_cache_home/.port-cache.$USER - if test -e $cache_file - # Delete if cache is older than 15 minutes - find "$cache_file" -ctime +15m | awk '{$1=$1;print}' | xargs rm - if test -f $cache_file - cat $cache_file - return - end - end - # Remove trailing whitespace and pipe into cache file - printf "all\ncurrent\nactive\ninactive\ninstalled\nuninstalled\noutdated" >$cache_file - port echo all | awk '{$1=$1};1' >>$cache_file & - cat $cache_file - return - end - - if type -q -f opkg - if set -q only_installed - opkg list-installed 2>/dev/null | sed -r 's/^([a-zA-Z0-9\-]+) - ([a-zA-Z0-9\-]+)/\1\t\2/g' - return - else - opkg list 2>/dev/null | sed -r 's/^([a-zA-Z0-9\-]+) - ([a-zA-Z0-9\-]+)/\1\t\2/g' - return - end - end - - if type -q -f apk - if set -q only_installed - apk info -q - return - else - apk search -q - return - end - end - - # Caches for 5 minutes - if type -q -f xbps-query - if not set -q only_installed - set -l cache_file $xdg_cache_home/.xbps-cache.$USER - if test -f $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 - 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 - return - end - end + __fish_print_port_packages $argv + and return + __fish_print_xbps_packages $argv + and return end diff --git a/share/functions/__fish_print_pacman_packages.fish b/share/functions/__fish_print_pacman_packages.fish index db4cd5145..194e375e1 100644 --- a/share/functions/__fish_print_pacman_packages.fish +++ b/share/functions/__fish_print_pacman_packages.fish @@ -8,7 +8,7 @@ function __fish_print_pacman_packages set -l xdg_cache_home (__fish_make_cache_dir) or return - if not set -q only_installed + if not set -q _flag_installed set -l cache_file $xdg_cache_home/.pac-cache.$USER if test -f $cache_file cat $cache_file diff --git a/share/functions/__fish_print_port_packages.fish b/share/functions/__fish_print_port_packages.fish new file mode 100644 index 000000000..ea3ed4b42 --- /dev/null +++ b/share/functions/__fish_print_port_packages.fish @@ -0,0 +1,25 @@ +function __fish_print_port_packages + type -q -f port || return 1 + + # port needs caching, as it tends to be slow + # BSD find is used for determining file age because HFS+ and APFS + # don't save unix time, but the actual date. Also BSD stat is vastly + # different from linux stat and converting its time format is tedious + set -l xdg_cache_home (__fish_make_cache_dir) + or return + + set -l cache_file $xdg_cache_home/.port-cache.$USER + if test -e $cache_file + # Delete if cache is older than 15 minutes + find "$cache_file" -ctime +15m | awk '{$1=$1;print}' | xargs rm + if test -f $cache_file + cat $cache_file + return + end + end + # Remove trailing whitespace and pipe into cache file + printf "all\ncurrent\nactive\ninactive\ninstalled\nuninstalled\noutdated" >$cache_file + port echo all | awk '{$1=$1};1' >>$cache_file & + cat $cache_file + return 0 +end diff --git a/share/functions/__fish_print_portage_packages.fish b/share/functions/__fish_print_portage_packages.fish new file mode 100644 index 000000000..5eae83ff4 --- /dev/null +++ b/share/functions/__fish_print_portage_packages.fish @@ -0,0 +1,15 @@ +function __fish_print_portage_packages + # This completes the package name from the portage tree. + # True for installing new packages. Function for printing + # installed on the system packages is in completions/emerge.fish + + # eix is MUCH faster than emerge so use it if it is available + if type -q -f eix + eix --only-names "^"(commandline -ct) | cut -d/ -f2 + return 0 + else if type -q -f emerge + emerge -s \^(commandline -ct) | string match -r "^\*.*" | cut -d' ' -f3 | cut -d/ -f2 + return 0 + end + return 1 +end diff --git a/share/functions/__fish_print_rpm_packages.fish b/share/functions/__fish_print_rpm_packages.fish new file mode 100644 index 000000000..48332dd4e --- /dev/null +++ b/share/functions/__fish_print_rpm_packages.fish @@ -0,0 +1,46 @@ +function __fish_print_rpm_packages + type -q -f rpm /usr/share/yum-cli/completion-helper.py || return 1 + + # We do not use "--installed", but we still allow passing it. + argparse i/installed -- $argv + or return 1 + + set -l xdg_cache_home (__fish_make_cache_dir) + or return + + if type -q -f /usr/share/yum-cli/completion-helper.py + # If the cache is less than six hours old, we do not recalculate it + set -l cache_file $xdg_cache_home/.yum-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 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 | sed "s/\..*/\tPackage/" >$cache_file & + return + end + + # Rpm is too slow for this job, so we set it up to do completions + # as a background job and cache the results. + if type -q -f rpm + # If the cache is less than five minutes old, we do not recalculate it + set -l cache_file $xdg_cache_home/.rpm-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 250 + if test $age -lt $max_age + return + end + end + + # Remove package version information from output and pipe into cache file + rpm -qa | sed -e 's/-[^-]*-[^-]*$/\t'Package'/' >$cache_file & + return + end +end diff --git a/share/functions/__fish_print_xbps_packages.fish b/share/functions/__fish_print_xbps_packages.fish new file mode 100644 index 000000000..82af7ae88 --- /dev/null +++ b/share/functions/__fish_print_xbps_packages.fish @@ -0,0 +1,28 @@ +function __fish_print_xbps_packages + # Caches for 5 minutes + type -q -f xbps-query || return 1 + + argparse i/installed -- $argv + or return 1 + + set -l xdg_cache_home (__fish_make_cache_dir) + or return + + if not set -q _flag_installed + set -l cache_file $xdg_cache_home/.xbps-cache.$USER + if test -f $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 + xbps-query -Rsl | sed 's/^... \([^ ]*\)-.* .*/\1/; s/$/\t'Package'/' | tee $cache_file + return 0 + else + xbps-query -l | sed 's/^.. \([^ ]*\)-.* .*/\1/' # TODO: actually put package versions in tab for locally installed packages + return 0 + end +end diff --git a/share/functions/__fish_print_zypper_packages.fish b/share/functions/__fish_print_zypper_packages.fish deleted file mode 100644 index 2cce045e3..000000000 --- a/share/functions/__fish_print_zypper_packages.fish +++ /dev/null @@ -1,28 +0,0 @@ -function __fish_print_zypper_packages - type -q -f zypper || return 1 - - set -l xdg_cache_home (__fish_make_cache_dir) - or return - - # Use libzypp cache file if available - if test -f /var/cache/zypp/solv/@System/solv.idx - awk '!/application:|srcpackage:|product:|pattern:|patch:/ {print $1'\tPackage'}' /var/cache/zypp/solv/*/solv.idx - return 0 - end - - # If the cache is less than five minutes old, we do not recalculate it - - set -l cache_file $xdg_cache_home/.zypper-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 - return 0 - end - end - - # Remove package version information from output and pipe into cache file - zypper --quiet --non-interactive search --type=package | tail -n +4 | sed -r 's/^. \| ((\w|[-_.])+).*/\1\t'Package'/g' >$cache_file & - return 0 -end