diff --git a/command-signatures/json/paru.json b/command-signatures/json/paru.json new file mode 100644 index 00000000..baebad9f --- /dev/null +++ b/command-signatures/json/paru.json @@ -0,0 +1,1201 @@ +{ + "name": "paru", + "description": "AUR helper and pacman wrapper", + "subcommands": [ + { + "name": "-U", + "description": "Upgrade or add package(s) and install the required dependencies", + "options": [ + { + "name": [ + "-d", + "--nodeps" + ], + "description": "Skips dependency version checks" + }, + { + "name": "--assume-installed", + "description": "Add a virtual package with version to the transaction to satisfy dependencies", + "args": { + "name": "package=version" + } + }, + { + "name": "--dbonly", + "description": "Adds/removes the database entry only, leaving all files in place" + }, + { + "name": "--noprogressbar", + "description": "Do not show a progress bar when downloading files" + }, + { + "name": "--noscriptlet", + "description": "If an install scriptlet exists, do not execute it" + }, + { + "name": [ + "-p", + "--print" + ], + "description": "Only print the targets instead of performing the actual operation" + }, + { + "name": "--print-format", + "description": "Specify a printf-like format to control the output of the --print operation" + }, + { + "name": [ + "-w", + "--downloadonly" + ], + "description": "Retrieve all packages from the server, but do not install/upgrade anything" + }, + { + "name": "--asdeps", + "description": "Install packages non-explicitly by faking their install reason to be installed as a dependency" + }, + { + "name": "--asexplicit", + "description": "Install packages explicitly by faking their install reason to be explicitly installed" + }, + { + "name": "--ignore", + "description": "Directs pacman to ignore upgrades of a package even if there is one available", + "args": { + "name": "package" + } + }, + { + "name": "--ignoregroup", + "description": "Directs pacman to ignore upgrades of all packages in a group even if there is one available", + "args": { + "name": "group" + } + }, + { + "name": "--needed", + "description": "Do not reinstall the targets that are already up-to-date" + }, + { + "name": "--overwrite", + "description": "Bypass file conflict checks and overwrite conflicting files", + "args": { + "name": "glob" + } + } + ], + "isVariadic": true, + "args": { + "generatorName": [ + "list_all_pkg_tar_files_in_cwd", + "list_installed_packages" + ] + } + }, + { + "name": "--upgrade", + "description": "Upgrade or add package(s) and install the required dependencies", + "options": [ + { + "name": [ + "-d", + "--nodeps" + ], + "description": "Skips dependency version checks" + }, + { + "name": "--assume-installed", + "description": "Add a virtual package with version to the transaction to satisfy dependencies", + "args": { + "name": "package=version" + } + }, + { + "name": "--dbonly", + "description": "Adds/removes the database entry only, leaving all files in place" + }, + { + "name": "--noprogressbar", + "description": "Do not show a progress bar when downloading files" + }, + { + "name": "--noscriptlet", + "description": "If an install scriptlet exists, do not execute it" + }, + { + "name": [ + "-p", + "--print" + ], + "description": "Only print the targets instead of performing the actual operation" + }, + { + "name": "--print-format", + "description": "Specify a printf-like format to control the output of the --print operation" + }, + { + "name": [ + "-w", + "--downloadonly" + ], + "description": "Retrieve all packages from the server, but do not install/upgrade anything" + }, + { + "name": "--asdeps", + "description": "Install packages non-explicitly by faking their install reason to be installed as a dependency" + }, + { + "name": "--asexplicit", + "description": "Install packages explicitly by faking their install reason to be explicitly installed" + }, + { + "name": "--ignore", + "description": "Directs pacman to ignore upgrades of a package even if there is one available", + "args": { + "name": "package" + } + }, + { + "name": "--ignoregroup", + "description": "Directs pacman to ignore upgrades of all packages in a group even if there is one available", + "args": { + "name": "group" + } + }, + { + "name": "--needed", + "description": "Do not reinstall the targets that are already up-to-date" + }, + { + "name": "--overwrite", + "description": "Bypass file conflict checks and overwrite conflicting files", + "args": { + "name": "glob" + } + } + ], + "isVariadic": true, + "args": { + "generatorName": [ + "list_all_pkg_tar_files_in_cwd", + "list_installed_packages" + ] + } + }, + { + "name": "-D", + "description": "Operate on the package database", + "options": [ + { + "name": "--asdeps", + "description": "Mark a package as non-explicitly installed", + "args": { + "name": "package", + "generatorName": "list_installed_packages" + } + }, + { + "name": "--asexplicit", + "description": "Mark a package as explicitly installed", + "args": { + "name": "package", + "generatorName": "list_installed_packages" + } + }, + { + "name": [ + "-k", + "--check" + ], + "description": "Check the local package database is internally consistent" + }, + { + "name": [ + "-q", + "--quiet" + ], + "description": "Suppress messages on successful completions of database operations" + } + ] + }, + { + "name": "--database", + "description": "Operate on the package database", + "options": [ + { + "name": "--asdeps", + "description": "Mark a package as non-explicitly installed", + "args": { + "name": "package", + "generatorName": "list_installed_packages" + } + }, + { + "name": "--asexplicit", + "description": "Mark a package as explicitly installed", + "args": { + "name": "package", + "generatorName": "list_installed_packages" + } + }, + { + "name": [ + "-k", + "--check" + ], + "description": "Check the local package database is internally consistent" + }, + { + "name": [ + "-q", + "--quiet" + ], + "description": "Suppress messages on successful completions of database operations" + } + ] + }, + { + "name": "-Q", + "description": "Query the package database", + "options": [ + { + "name": [ + "-c", + "--changelog" + ], + "description": "View the changelog of package if it exists" + }, + { + "name": [ + "-d", + "--deps" + ], + "description": "Filter output to packages installed as dependencies" + }, + { + "name": [ + "-e", + "--explicit" + ], + "description": "Filter output to explicitly installed packages" + }, + { + "name": [ + "-g", + "--groups" + ], + "description": "Display all packages that are members of a named group" + }, + { + "name": [ + "-i", + "--info" + ], + "description": "Display information on a given package" + }, + { + "name": [ + "-k", + "--check" + ], + "description": "Check that all files owned by the given package(s) are present on the system" + }, + { + "name": [ + "-l", + "--list" + ], + "description": "List all files owned by a given package" + }, + { + "name": [ + "-m", + "--foreign" + ], + "description": "Filter output to packages that were not found in the sync database(s)" + }, + { + "name": [ + "-n", + "--native" + ], + "description": "Filter output to packages that are found in the sync database(s)" + }, + { + "name": [ + "-o", + "--owns" + ], + "description": "Search for the packages that own the specified file(s)", + "args": { + "name": "file", + "template": "filepaths" + } + }, + { + "name": [ + "-p", + "--file" + ], + "description": "Signifies that the package supplied on the command line is a file and not an entry in the database" + }, + { + "name": [ + "-q", + "--quiet" + ], + "description": "Show less information for certain query operations" + }, + { + "name": [ + "-s", + "--search" + ], + "description": "Search each locally-installed package for names or descriptions that match the given regex", + "args": { + "name": "regexp" + } + }, + { + "name": [ + "-t", + "--unrequired" + ], + "description": "Filter output to print only packages neither required nor optionally required by any currently installed package" + }, + { + "name": [ + "-u", + "--upgrades" + ], + "description": "Filter output to print only packages that are out-of-date on the local system" + } + ], + "args": { + "generatorName": "list_installed_packages", + "template": "filepaths" + } + }, + { + "name": "--query", + "description": "Query the package database", + "options": [ + { + "name": [ + "-c", + "--changelog" + ], + "description": "View the changelog of package if it exists" + }, + { + "name": [ + "-d", + "--deps" + ], + "description": "Filter output to packages installed as dependencies" + }, + { + "name": [ + "-e", + "--explicit" + ], + "description": "Filter output to explicitly installed packages" + }, + { + "name": [ + "-g", + "--groups" + ], + "description": "Display all packages that are members of a named group" + }, + { + "name": [ + "-i", + "--info" + ], + "description": "Display information on a given package" + }, + { + "name": [ + "-k", + "--check" + ], + "description": "Check that all files owned by the given package(s) are present on the system" + }, + { + "name": [ + "-l", + "--list" + ], + "description": "List all files owned by a given package" + }, + { + "name": [ + "-m", + "--foreign" + ], + "description": "Filter output to packages that were not found in the sync database(s)" + }, + { + "name": [ + "-n", + "--native" + ], + "description": "Filter output to packages that are found in the sync database(s)" + }, + { + "name": [ + "-o", + "--owns" + ], + "description": "Search for the packages that own the specified file(s)", + "args": { + "name": "file", + "template": "filepaths" + } + }, + { + "name": [ + "-p", + "--file" + ], + "description": "Signifies that the package supplied on the command line is a file and not an entry in the database" + }, + { + "name": [ + "-q", + "--quiet" + ], + "description": "Show less information for certain query operations" + }, + { + "name": [ + "-s", + "--search" + ], + "description": "Search each locally-installed package for names or descriptions that match the given regex", + "args": { + "name": "regexp" + } + }, + { + "name": [ + "-t", + "--unrequired" + ], + "description": "Filter output to print only packages neither required nor optionally required by any currently installed package" + }, + { + "name": [ + "-u", + "--upgrades" + ], + "description": "Filter output to print only packages that are out-of-date on the local system" + } + ], + "args": { + "generatorName": "list_installed_packages", + "template": "filepaths" + } + }, + { + "name": "-R", + "description": "Remove package(s) from the system", + "options": [ + { + "name": [ + "-d", + "--nodeps" + ], + "description": "Skips dependency version checks" + }, + { + "name": "--assume-installed", + "description": "Add a virtual package with version to the transaction to satisfy dependencies", + "args": { + "name": "package=version" + } + }, + { + "name": "--dbonly", + "description": "Adds/removes the database entry only, leaving all files in place" + }, + { + "name": "--noprogressbar", + "description": "Do not show a progress bar when downloading files" + }, + { + "name": "--noscriptlet", + "description": "If an install scriptlet exists, do not execute it" + }, + { + "name": [ + "-p", + "--print" + ], + "description": "Only print the targets instead of performing the actual operation" + }, + { + "name": "--print-format", + "description": "Specify a printf-like format to control the output of the --print operation" + }, + { + "name": [ + "-c", + "--cascade" + ], + "description": "Remove all target packages, as well as all packages that depend on one or more target packages" + }, + { + "name": [ + "-n", + "--nosave" + ], + "description": "Instructs pacman to ignore file backup designations" + }, + { + "name": [ + "-s", + "--recursive" + ], + "description": "Remove each target specified including all of their dependencies, provided that they are not required by other packages and they were not explicity installed by the user" + }, + { + "name": [ + "-u", + "--unneeded" + ], + "description": "Removes targets that are not required by any other packages" + } + ], + "args": { + "generatorName": "list_installed_packages" + } + }, + { + "name": "--remove", + "description": "Remove package(s) from the system", + "options": [ + { + "name": [ + "-d", + "--nodeps" + ], + "description": "Skips dependency version checks" + }, + { + "name": "--assume-installed", + "description": "Add a virtual package with version to the transaction to satisfy dependencies", + "args": { + "name": "package=version" + } + }, + { + "name": "--dbonly", + "description": "Adds/removes the database entry only, leaving all files in place" + }, + { + "name": "--noprogressbar", + "description": "Do not show a progress bar when downloading files" + }, + { + "name": "--noscriptlet", + "description": "If an install scriptlet exists, do not execute it" + }, + { + "name": [ + "-p", + "--print" + ], + "description": "Only print the targets instead of performing the actual operation" + }, + { + "name": "--print-format", + "description": "Specify a printf-like format to control the output of the --print operation" + }, + { + "name": [ + "-c", + "--cascade" + ], + "description": "Remove all target packages, as well as all packages that depend on one or more target packages" + }, + { + "name": [ + "-n", + "--nosave" + ], + "description": "Instructs pacman to ignore file backup designations" + }, + { + "name": [ + "-s", + "--recursive" + ], + "description": "Remove each target specified including all of their dependencies, provided that they are not required by other packages and they were not explicity installed by the user" + }, + { + "name": [ + "-u", + "--unneeded" + ], + "description": "Removes targets that are not required by any other packages" + } + ], + "args": { + "generatorName": "list_installed_packages" + } + }, + { + "name": "-S", + "description": "Synchronize packages. Installs packages from the official repositories and the AUR, including all dependencies", + "options": [ + { + "name": [ + "-d", + "--nodeps" + ], + "description": "Skips dependency version checks" + }, + { + "name": "--assume-installed", + "description": "Add a virtual package with version to the transaction to satisfy dependencies", + "args": { + "name": "package=version" + } + }, + { + "name": "--dbonly", + "description": "Adds/removes the database entry only, leaving all files in place" + }, + { + "name": "--noprogressbar", + "description": "Do not show a progress bar when downloading files" + }, + { + "name": "--noscriptlet", + "description": "If an install scriptlet exists, do not execute it" + }, + { + "name": [ + "-p", + "--print" + ], + "description": "Only print the targets instead of performing the actual operation" + }, + { + "name": "--print-format", + "description": "Specify a printf-like format to control the output of the --print operation" + }, + { + "name": [ + "-w", + "--downloadonly" + ], + "description": "Retrieve all packages from the server, but do not install/upgrade anything" + }, + { + "name": "--asdeps", + "description": "Install packages non-explicitly by faking their install reason to be installed as a dependency" + }, + { + "name": "--asexplicit", + "description": "Install packages explicitly by faking their install reason to be explicitly installed" + }, + { + "name": "--ignore", + "description": "Directs pacman to ignore upgrades of a package even if there is one available", + "args": { + "name": "package" + } + }, + { + "name": "--ignoregroup", + "description": "Directs pacman to ignore upgrades of all packages in a group even if there is one available", + "args": { + "name": "group" + } + }, + { + "name": "--needed", + "description": "Do not reinstall the targets that are already up-to-date" + }, + { + "name": "--overwrite", + "description": "Bypass file conflict checks and overwrite conflicting files", + "args": { + "name": "glob" + } + }, + { + "name": [ + "-c", + "--clean" + ], + "description": "Remove packages that are no longer installed from the cache, currently unused sync databases, and (via paru) cached AUR packages" + }, + { + "name": [ + "-g", + "--groups" + ], + "description": "Display all the members for each package group specified" + }, + { + "name": [ + "-i", + "--info" + ], + "description": "Display information on a given sync database or AUR package" + }, + { + "name": [ + "-l", + "--list" + ], + "description": "List all packages in the specified repositories" + }, + { + "name": [ + "-q", + "--quiet" + ], + "description": "Show less information for certain sync operations" + }, + { + "name": [ + "-s", + "--search" + ], + "description": "Search the sync databases and the AUR for names or descriptions that match the given regex", + "args": { + "name": "regexp" + } + }, + { + "name": [ + "-u", + "--sysupgrade" + ], + "description": "Upgrades all packages, including AUR packages, that are out-of-date" + }, + { + "name": [ + "-y", + "--refresh" + ], + "description": "Download a fresh copy of the master package database from the server(s)" + }, + { + "name": "--repo", + "description": "Assume all targets are from the repositories" + }, + { + "name": [ + "-a", + "--aur" + ], + "description": "Assume all targets are from the AUR" + } + ], + "args": { + "generatorName": "list_all_packages" + } + }, + { + "name": "--sync", + "description": "Synchronize packages. Installs packages from the official repositories and the AUR, including all dependencies", + "options": [ + { + "name": [ + "-d", + "--nodeps" + ], + "description": "Skips dependency version checks" + }, + { + "name": "--assume-installed", + "description": "Add a virtual package with version to the transaction to satisfy dependencies", + "args": { + "name": "package=version" + } + }, + { + "name": "--dbonly", + "description": "Adds/removes the database entry only, leaving all files in place" + }, + { + "name": "--noprogressbar", + "description": "Do not show a progress bar when downloading files" + }, + { + "name": "--noscriptlet", + "description": "If an install scriptlet exists, do not execute it" + }, + { + "name": [ + "-p", + "--print" + ], + "description": "Only print the targets instead of performing the actual operation" + }, + { + "name": "--print-format", + "description": "Specify a printf-like format to control the output of the --print operation" + }, + { + "name": [ + "-w", + "--downloadonly" + ], + "description": "Retrieve all packages from the server, but do not install/upgrade anything" + }, + { + "name": "--asdeps", + "description": "Install packages non-explicitly by faking their install reason to be installed as a dependency" + }, + { + "name": "--asexplicit", + "description": "Install packages explicitly by faking their install reason to be explicitly installed" + }, + { + "name": "--ignore", + "description": "Directs pacman to ignore upgrades of a package even if there is one available", + "args": { + "name": "package" + } + }, + { + "name": "--ignoregroup", + "description": "Directs pacman to ignore upgrades of all packages in a group even if there is one available", + "args": { + "name": "group" + } + }, + { + "name": "--needed", + "description": "Do not reinstall the targets that are already up-to-date" + }, + { + "name": "--overwrite", + "description": "Bypass file conflict checks and overwrite conflicting files", + "args": { + "name": "glob" + } + }, + { + "name": [ + "-c", + "--clean" + ], + "description": "Remove packages that are no longer installed from the cache, currently unused sync databases, and (via paru) cached AUR packages" + }, + { + "name": [ + "-g", + "--groups" + ], + "description": "Display all the members for each package group specified" + }, + { + "name": [ + "-i", + "--info" + ], + "description": "Display information on a given sync database or AUR package" + }, + { + "name": [ + "-l", + "--list" + ], + "description": "List all packages in the specified repositories" + }, + { + "name": [ + "-q", + "--quiet" + ], + "description": "Show less information for certain sync operations" + }, + { + "name": [ + "-s", + "--search" + ], + "description": "Search the sync databases and the AUR for names or descriptions that match the given regex", + "args": { + "name": "regexp" + } + }, + { + "name": [ + "-u", + "--sysupgrade" + ], + "description": "Upgrades all packages, including AUR packages, that are out-of-date" + }, + { + "name": [ + "-y", + "--refresh" + ], + "description": "Download a fresh copy of the master package database from the server(s)" + }, + { + "name": "--repo", + "description": "Assume all targets are from the repositories" + }, + { + "name": [ + "-a", + "--aur" + ], + "description": "Assume all targets are from the AUR" + } + ], + "args": { + "generatorName": "list_all_packages" + } + }, + { + "name": "-T", + "description": "Check dependencies", + "options": [ + { + "name": [ + "-a", + "--aur" + ], + "description": "Filter the given list of packages down to the ones that appear in the AUR" + } + ] + }, + { + "name": "--deptest", + "description": "Check dependencies", + "options": [ + { + "name": [ + "-a", + "--aur" + ], + "description": "Filter the given list of packages down to the ones that appear in the AUR" + } + ] + }, + { + "name": "-F", + "description": "Query the files database", + "options": [ + { + "name": [ + "-y", + "--refresh" + ], + "description": "Download fresh package databases from the server" + }, + { + "name": [ + "-l", + "--list" + ], + "description": "List the files owned by the queried package" + }, + { + "name": [ + "-x", + "--regex" + ], + "description": "Interpret each query as a regular expression" + }, + { + "name": [ + "-q", + "--quiet" + ], + "description": "Show less information for certain file operations" + }, + { + "name": "--machinereadable", + "description": "Print each match in a machine readable output format" + } + ] + }, + { + "name": "--files", + "description": "Query the files database", + "options": [ + { + "name": [ + "-y", + "--refresh" + ], + "description": "Download fresh package databases from the server" + }, + { + "name": [ + "-l", + "--list" + ], + "description": "List the files owned by the queried package" + }, + { + "name": [ + "-x", + "--regex" + ], + "description": "Interpret each query as a regular expression" + }, + { + "name": [ + "-q", + "--quiet" + ], + "description": "Show less information for certain file operations" + }, + { + "name": "--machinereadable", + "description": "Print each match in a machine readable output format" + } + ] + } + ], + "options": [ + { + "name": [ + "-h", + "--help" + ], + "description": "Display syntax for the given operation or if no operation was supplied, then the general syntax is shown", + "priority": 40 + }, + { + "name": [ + "-V", + "--version" + ], + "description": "Display version and exit", + "isPersistent": true, + "priority": 40 + }, + { + "name": [ + "-b", + "--dbpath" + ], + "description": "Specify an alternative database location", + "args": { + "name": "path", + "template": "filepaths" + } + }, + { + "name": [ + "-r", + "--root" + ], + "description": "Specify an alternative installation root", + "args": { + "name": "path", + "template": "filepaths" + } + }, + { + "name": [ + "-v", + "--verbose" + ], + "description": "Output paths such as the Root, Conf File, DB Path, Cache Dirs, etc" + }, + { + "name": "--arch", + "description": "Specify an alternate architecture", + "args": { + "name": "arch" + } + }, + { + "name": "--cachedir", + "description": "Specify an alternative package cache location", + "args": { + "name": "dir", + "template": "folders" + } + }, + { + "name": "--color", + "description": "Specify when to enable coloring", + "args": { + "name": "when" + } + }, + { + "name": "--config", + "description": "Specify an alternate configuration file", + "args": { + "name": "file", + "template": "filepaths" + } + }, + { + "name": "--debug", + "description": "Display debug messages" + }, + { + "name": "--gpgdir", + "description": "Specify a directory of files used by GnuPG to verify package signatures", + "args": { + "name": "dir", + "template": "folders" + } + }, + { + "name": "--logfile", + "description": "Specify an alternate log file (absolute path)", + "args": { + "name": "file", + "template": "filepaths" + } + }, + { + "name": "--hookdir", + "description": "Specify an alternative directory containing hook files", + "args": { + "name": "dir", + "template": "folders" + } + }, + { + "name": "--noconfirm", + "description": "Bypass any and all 'Are you sure?' messages" + }, + { + "name": "--confirm", + "description": "Cancels the effects of a previous --noconfirm" + }, + { + "name": "--disable-download-timeout", + "description": "Disable defaults for low speed limit and timeout on downloads" + }, + { + "name": "--sysroot", + "description": "Specify an alternative system root", + "args": { + "name": "dir", + "template": "folders" + } + }, + { + "name": "--repo", + "description": "Assume all targets are from the repositories" + }, + { + "name": [ + "-a", + "--aur" + ], + "description": "Assume all targets are from the AUR" + } + ] +} diff --git a/command-signatures/json/yay.json b/command-signatures/json/yay.json new file mode 100644 index 00000000..caceb51e --- /dev/null +++ b/command-signatures/json/yay.json @@ -0,0 +1,1189 @@ +{ + "name": "yay", + "description": "Pacman wrapper and AUR helper", + "subcommands": [ + { + "name": "-U", + "description": "Upgrade or add package(s) and install the required dependencies", + "options": [ + { + "name": [ + "-d", + "--nodeps" + ], + "description": "Skips dependency version checks" + }, + { + "name": "--assume-installed", + "description": "Add a virtual package with version to the transaction to satisfy dependencies", + "args": { + "name": "package=version" + } + }, + { + "name": "--dbonly", + "description": "Adds/removes the database entry only, leaving all files in place" + }, + { + "name": "--noprogressbar", + "description": "Do not show a progress bar when downloading files" + }, + { + "name": "--noscriptlet", + "description": "If an install scriptlet exists, do not execute it" + }, + { + "name": [ + "-p", + "--print" + ], + "description": "Only print the targets instead of performing the actual operation" + }, + { + "name": "--print-format", + "description": "Specify a printf-like format to control the output of the --print operation" + }, + { + "name": [ + "-w", + "--downloadonly" + ], + "description": "Retrieve all packages from the server, but do not install/upgrade anything" + }, + { + "name": "--asdeps", + "description": "Install packages non-explicitly by faking their install reason to be installed as a dependency" + }, + { + "name": "--asexplicit", + "description": "Install packages explicitly by faking their install reason to be explicitly installed" + }, + { + "name": "--ignore", + "description": "Directs pacman to ignore upgrades of a package even if there is one available", + "args": { + "name": "package" + } + }, + { + "name": "--ignoregroup", + "description": "Directs pacman to ignore upgrades of all packages in a group even if there is one available", + "args": { + "name": "group" + } + }, + { + "name": "--needed", + "description": "Do not reinstall the targets that are already up-to-date" + }, + { + "name": "--overwrite", + "description": "Bypass file conflict checks and overwrite conflicting files", + "args": { + "name": "glob" + } + } + ], + "isVariadic": true, + "args": { + "generatorName": [ + "list_all_pkg_tar_files_in_cwd", + "list_installed_packages" + ] + } + }, + { + "name": "--upgrade", + "description": "Upgrade or add package(s) and install the required dependencies", + "options": [ + { + "name": [ + "-d", + "--nodeps" + ], + "description": "Skips dependency version checks" + }, + { + "name": "--assume-installed", + "description": "Add a virtual package with version to the transaction to satisfy dependencies", + "args": { + "name": "package=version" + } + }, + { + "name": "--dbonly", + "description": "Adds/removes the database entry only, leaving all files in place" + }, + { + "name": "--noprogressbar", + "description": "Do not show a progress bar when downloading files" + }, + { + "name": "--noscriptlet", + "description": "If an install scriptlet exists, do not execute it" + }, + { + "name": [ + "-p", + "--print" + ], + "description": "Only print the targets instead of performing the actual operation" + }, + { + "name": "--print-format", + "description": "Specify a printf-like format to control the output of the --print operation" + }, + { + "name": [ + "-w", + "--downloadonly" + ], + "description": "Retrieve all packages from the server, but do not install/upgrade anything" + }, + { + "name": "--asdeps", + "description": "Install packages non-explicitly by faking their install reason to be installed as a dependency" + }, + { + "name": "--asexplicit", + "description": "Install packages explicitly by faking their install reason to be explicitly installed" + }, + { + "name": "--ignore", + "description": "Directs pacman to ignore upgrades of a package even if there is one available", + "args": { + "name": "package" + } + }, + { + "name": "--ignoregroup", + "description": "Directs pacman to ignore upgrades of all packages in a group even if there is one available", + "args": { + "name": "group" + } + }, + { + "name": "--needed", + "description": "Do not reinstall the targets that are already up-to-date" + }, + { + "name": "--overwrite", + "description": "Bypass file conflict checks and overwrite conflicting files", + "args": { + "name": "glob" + } + } + ], + "isVariadic": true, + "args": { + "generatorName": [ + "list_all_pkg_tar_files_in_cwd", + "list_installed_packages" + ] + } + }, + { + "name": "-D", + "description": "Operate on the package database", + "options": [ + { + "name": "--asdeps", + "description": "Mark a package as non-explicitly installed", + "args": { + "name": "package", + "generatorName": "list_installed_packages" + } + }, + { + "name": "--asexplicit", + "description": "Mark a package as explicitly installed", + "args": { + "name": "package", + "generatorName": "list_installed_packages" + } + }, + { + "name": [ + "-k", + "--check" + ], + "description": "Check the local package database is internally consistent" + }, + { + "name": [ + "-q", + "--quiet" + ], + "description": "Suppress messages on successful completions of database operations" + } + ] + }, + { + "name": "--database", + "description": "Operate on the package database", + "options": [ + { + "name": "--asdeps", + "description": "Mark a package as non-explicitly installed", + "args": { + "name": "package", + "generatorName": "list_installed_packages" + } + }, + { + "name": "--asexplicit", + "description": "Mark a package as explicitly installed", + "args": { + "name": "package", + "generatorName": "list_installed_packages" + } + }, + { + "name": [ + "-k", + "--check" + ], + "description": "Check the local package database is internally consistent" + }, + { + "name": [ + "-q", + "--quiet" + ], + "description": "Suppress messages on successful completions of database operations" + } + ] + }, + { + "name": "-Q", + "description": "Query the package database", + "options": [ + { + "name": [ + "-c", + "--changelog" + ], + "description": "View the changelog of package if it exists" + }, + { + "name": [ + "-d", + "--deps" + ], + "description": "Filter output to packages installed as dependencies" + }, + { + "name": [ + "-e", + "--explicit" + ], + "description": "Filter output to explicitly installed packages" + }, + { + "name": [ + "-g", + "--groups" + ], + "description": "Display all packages that are members of a named group" + }, + { + "name": [ + "-i", + "--info" + ], + "description": "Display information on a given package" + }, + { + "name": [ + "-k", + "--check" + ], + "description": "Check that all files owned by the given package(s) are present on the system" + }, + { + "name": [ + "-l", + "--list" + ], + "description": "List all files owned by a given package" + }, + { + "name": [ + "-m", + "--foreign" + ], + "description": "Filter output to packages that were not found in the sync database(s)" + }, + { + "name": [ + "-n", + "--native" + ], + "description": "Filter output to packages that are found in the sync database(s)" + }, + { + "name": [ + "-o", + "--owns" + ], + "description": "Search for the packages that own the specified file(s)", + "args": { + "name": "file", + "template": "filepaths" + } + }, + { + "name": [ + "-p", + "--file" + ], + "description": "Signifies that the package supplied on the command line is a file and not an entry in the database" + }, + { + "name": [ + "-q", + "--quiet" + ], + "description": "Show less information for certain query operations" + }, + { + "name": [ + "-s", + "--search" + ], + "description": "Search each locally-installed package for names or descriptions that match the given regex", + "args": { + "name": "regexp" + } + }, + { + "name": [ + "-t", + "--unrequired" + ], + "description": "Filter output to print only packages neither required nor optionally required by any currently installed package" + }, + { + "name": [ + "-u", + "--upgrades" + ], + "description": "Filter output to print only packages that are out-of-date on the local system" + } + ], + "args": { + "generatorName": "list_installed_packages", + "template": "filepaths" + } + }, + { + "name": "--query", + "description": "Query the package database", + "options": [ + { + "name": [ + "-c", + "--changelog" + ], + "description": "View the changelog of package if it exists" + }, + { + "name": [ + "-d", + "--deps" + ], + "description": "Filter output to packages installed as dependencies" + }, + { + "name": [ + "-e", + "--explicit" + ], + "description": "Filter output to explicitly installed packages" + }, + { + "name": [ + "-g", + "--groups" + ], + "description": "Display all packages that are members of a named group" + }, + { + "name": [ + "-i", + "--info" + ], + "description": "Display information on a given package" + }, + { + "name": [ + "-k", + "--check" + ], + "description": "Check that all files owned by the given package(s) are present on the system" + }, + { + "name": [ + "-l", + "--list" + ], + "description": "List all files owned by a given package" + }, + { + "name": [ + "-m", + "--foreign" + ], + "description": "Filter output to packages that were not found in the sync database(s)" + }, + { + "name": [ + "-n", + "--native" + ], + "description": "Filter output to packages that are found in the sync database(s)" + }, + { + "name": [ + "-o", + "--owns" + ], + "description": "Search for the packages that own the specified file(s)", + "args": { + "name": "file", + "template": "filepaths" + } + }, + { + "name": [ + "-p", + "--file" + ], + "description": "Signifies that the package supplied on the command line is a file and not an entry in the database" + }, + { + "name": [ + "-q", + "--quiet" + ], + "description": "Show less information for certain query operations" + }, + { + "name": [ + "-s", + "--search" + ], + "description": "Search each locally-installed package for names or descriptions that match the given regex", + "args": { + "name": "regexp" + } + }, + { + "name": [ + "-t", + "--unrequired" + ], + "description": "Filter output to print only packages neither required nor optionally required by any currently installed package" + }, + { + "name": [ + "-u", + "--upgrades" + ], + "description": "Filter output to print only packages that are out-of-date on the local system" + } + ], + "args": { + "generatorName": "list_installed_packages", + "template": "filepaths" + } + }, + { + "name": "-R", + "description": "Remove package(s) from the system", + "options": [ + { + "name": [ + "-d", + "--nodeps" + ], + "description": "Skips dependency version checks" + }, + { + "name": "--assume-installed", + "description": "Add a virtual package with version to the transaction to satisfy dependencies", + "args": { + "name": "package=version" + } + }, + { + "name": "--dbonly", + "description": "Adds/removes the database entry only, leaving all files in place" + }, + { + "name": "--noprogressbar", + "description": "Do not show a progress bar when downloading files" + }, + { + "name": "--noscriptlet", + "description": "If an install scriptlet exists, do not execute it" + }, + { + "name": [ + "-p", + "--print" + ], + "description": "Only print the targets instead of performing the actual operation" + }, + { + "name": "--print-format", + "description": "Specify a printf-like format to control the output of the --print operation" + }, + { + "name": [ + "-c", + "--cascade" + ], + "description": "Remove all target packages, as well as all packages that depend on one or more target packages" + }, + { + "name": [ + "-n", + "--nosave" + ], + "description": "Instructs pacman to ignore file backup designations" + }, + { + "name": [ + "-s", + "--recursive" + ], + "description": "Remove each target specified including all of their dependencies, provided that they are not required by other packages and they were not explicity installed by the user" + }, + { + "name": [ + "-u", + "--unneeded" + ], + "description": "Removes targets that are not required by any other packages" + } + ], + "args": { + "generatorName": "list_installed_packages" + } + }, + { + "name": "--remove", + "description": "Remove package(s) from the system", + "options": [ + { + "name": [ + "-d", + "--nodeps" + ], + "description": "Skips dependency version checks" + }, + { + "name": "--assume-installed", + "description": "Add a virtual package with version to the transaction to satisfy dependencies", + "args": { + "name": "package=version" + } + }, + { + "name": "--dbonly", + "description": "Adds/removes the database entry only, leaving all files in place" + }, + { + "name": "--noprogressbar", + "description": "Do not show a progress bar when downloading files" + }, + { + "name": "--noscriptlet", + "description": "If an install scriptlet exists, do not execute it" + }, + { + "name": [ + "-p", + "--print" + ], + "description": "Only print the targets instead of performing the actual operation" + }, + { + "name": "--print-format", + "description": "Specify a printf-like format to control the output of the --print operation" + }, + { + "name": [ + "-c", + "--cascade" + ], + "description": "Remove all target packages, as well as all packages that depend on one or more target packages" + }, + { + "name": [ + "-n", + "--nosave" + ], + "description": "Instructs pacman to ignore file backup designations" + }, + { + "name": [ + "-s", + "--recursive" + ], + "description": "Remove each target specified including all of their dependencies, provided that they are not required by other packages and they were not explicity installed by the user" + }, + { + "name": [ + "-u", + "--unneeded" + ], + "description": "Removes targets that are not required by any other packages" + } + ], + "args": { + "generatorName": "list_installed_packages" + } + }, + { + "name": "-S", + "description": "Synchronize packages. Installs packages from the official repositories and the AUR, including all dependencies", + "options": [ + { + "name": [ + "-d", + "--nodeps" + ], + "description": "Skips dependency version checks" + }, + { + "name": "--assume-installed", + "description": "Add a virtual package with version to the transaction to satisfy dependencies", + "args": { + "name": "package=version" + } + }, + { + "name": "--dbonly", + "description": "Adds/removes the database entry only, leaving all files in place" + }, + { + "name": "--noprogressbar", + "description": "Do not show a progress bar when downloading files" + }, + { + "name": "--noscriptlet", + "description": "If an install scriptlet exists, do not execute it" + }, + { + "name": [ + "-p", + "--print" + ], + "description": "Only print the targets instead of performing the actual operation" + }, + { + "name": "--print-format", + "description": "Specify a printf-like format to control the output of the --print operation" + }, + { + "name": [ + "-w", + "--downloadonly" + ], + "description": "Retrieve all packages from the server, but do not install/upgrade anything" + }, + { + "name": "--asdeps", + "description": "Install packages non-explicitly by faking their install reason to be installed as a dependency" + }, + { + "name": "--asexplicit", + "description": "Install packages explicitly by faking their install reason to be explicitly installed" + }, + { + "name": "--ignore", + "description": "Directs pacman to ignore upgrades of a package even if there is one available", + "args": { + "name": "package" + } + }, + { + "name": "--ignoregroup", + "description": "Directs pacman to ignore upgrades of all packages in a group even if there is one available", + "args": { + "name": "group" + } + }, + { + "name": "--needed", + "description": "Do not reinstall the targets that are already up-to-date" + }, + { + "name": "--overwrite", + "description": "Bypass file conflict checks and overwrite conflicting files", + "args": { + "name": "glob" + } + }, + { + "name": [ + "-c", + "--clean" + ], + "description": "Remove packages that are no longer installed from the cache, currently unused sync databases, and (via yay) cached AUR packages" + }, + { + "name": [ + "-g", + "--groups" + ], + "description": "Display all the members for each package group specified" + }, + { + "name": [ + "-i", + "--info" + ], + "description": "Display information on a given sync database or AUR package" + }, + { + "name": [ + "-l", + "--list" + ], + "description": "List all packages in the specified repositories" + }, + { + "name": [ + "-q", + "--quiet" + ], + "description": "Show less information for certain sync operations" + }, + { + "name": [ + "-s", + "--search" + ], + "description": "Search the sync databases and the AUR for names or descriptions that match the given regex", + "args": { + "name": "regexp" + } + }, + { + "name": [ + "-u", + "--sysupgrade" + ], + "description": "Upgrades all packages, including AUR packages, that are out-of-date" + }, + { + "name": [ + "-y", + "--refresh" + ], + "description": "Download a fresh copy of the master package database from the server(s)" + }, + { + "name": [ + "-N", + "--repo" + ], + "description": "Assume all targets are from the repositories" + }, + { + "name": [ + "-a", + "--aur" + ], + "description": "Assume all targets are from the AUR" + } + ], + "args": { + "generatorName": "list_all_packages" + } + }, + { + "name": "--sync", + "description": "Synchronize packages. Installs packages from the official repositories and the AUR, including all dependencies", + "options": [ + { + "name": [ + "-d", + "--nodeps" + ], + "description": "Skips dependency version checks" + }, + { + "name": "--assume-installed", + "description": "Add a virtual package with version to the transaction to satisfy dependencies", + "args": { + "name": "package=version" + } + }, + { + "name": "--dbonly", + "description": "Adds/removes the database entry only, leaving all files in place" + }, + { + "name": "--noprogressbar", + "description": "Do not show a progress bar when downloading files" + }, + { + "name": "--noscriptlet", + "description": "If an install scriptlet exists, do not execute it" + }, + { + "name": [ + "-p", + "--print" + ], + "description": "Only print the targets instead of performing the actual operation" + }, + { + "name": "--print-format", + "description": "Specify a printf-like format to control the output of the --print operation" + }, + { + "name": [ + "-w", + "--downloadonly" + ], + "description": "Retrieve all packages from the server, but do not install/upgrade anything" + }, + { + "name": "--asdeps", + "description": "Install packages non-explicitly by faking their install reason to be installed as a dependency" + }, + { + "name": "--asexplicit", + "description": "Install packages explicitly by faking their install reason to be explicitly installed" + }, + { + "name": "--ignore", + "description": "Directs pacman to ignore upgrades of a package even if there is one available", + "args": { + "name": "package" + } + }, + { + "name": "--ignoregroup", + "description": "Directs pacman to ignore upgrades of all packages in a group even if there is one available", + "args": { + "name": "group" + } + }, + { + "name": "--needed", + "description": "Do not reinstall the targets that are already up-to-date" + }, + { + "name": "--overwrite", + "description": "Bypass file conflict checks and overwrite conflicting files", + "args": { + "name": "glob" + } + }, + { + "name": [ + "-c", + "--clean" + ], + "description": "Remove packages that are no longer installed from the cache, currently unused sync databases, and (via yay) cached AUR packages" + }, + { + "name": [ + "-g", + "--groups" + ], + "description": "Display all the members for each package group specified" + }, + { + "name": [ + "-i", + "--info" + ], + "description": "Display information on a given sync database or AUR package" + }, + { + "name": [ + "-l", + "--list" + ], + "description": "List all packages in the specified repositories" + }, + { + "name": [ + "-q", + "--quiet" + ], + "description": "Show less information for certain sync operations" + }, + { + "name": [ + "-s", + "--search" + ], + "description": "Search the sync databases and the AUR for names or descriptions that match the given regex", + "args": { + "name": "regexp" + } + }, + { + "name": [ + "-u", + "--sysupgrade" + ], + "description": "Upgrades all packages, including AUR packages, that are out-of-date" + }, + { + "name": [ + "-y", + "--refresh" + ], + "description": "Download a fresh copy of the master package database from the server(s)" + }, + { + "name": [ + "-N", + "--repo" + ], + "description": "Assume all targets are from the repositories" + }, + { + "name": [ + "-a", + "--aur" + ], + "description": "Assume all targets are from the AUR" + } + ], + "args": { + "generatorName": "list_all_packages" + } + }, + { + "name": "-T", + "description": "Check dependencies" + }, + { + "name": "--deptest", + "description": "Check dependencies" + }, + { + "name": "-F", + "description": "Query the files database", + "options": [ + { + "name": [ + "-y", + "--refresh" + ], + "description": "Download fresh package databases from the server" + }, + { + "name": [ + "-l", + "--list" + ], + "description": "List the files owned by the queried package" + }, + { + "name": [ + "-x", + "--regex" + ], + "description": "Interpret each query as a regular expression" + }, + { + "name": [ + "-q", + "--quiet" + ], + "description": "Show less information for certain file operations" + }, + { + "name": "--machinereadable", + "description": "Print each match in a machine readable output format" + } + ] + }, + { + "name": "--files", + "description": "Query the files database", + "options": [ + { + "name": [ + "-y", + "--refresh" + ], + "description": "Download fresh package databases from the server" + }, + { + "name": [ + "-l", + "--list" + ], + "description": "List the files owned by the queried package" + }, + { + "name": [ + "-x", + "--regex" + ], + "description": "Interpret each query as a regular expression" + }, + { + "name": [ + "-q", + "--quiet" + ], + "description": "Show less information for certain file operations" + }, + { + "name": "--machinereadable", + "description": "Print each match in a machine readable output format" + } + ] + } + ], + "options": [ + { + "name": [ + "-h", + "--help" + ], + "description": "Display syntax for the given operation or if no operation was supplied, then the general syntax is shown", + "priority": 40 + }, + { + "name": [ + "-V", + "--version" + ], + "description": "Display version and exit", + "isPersistent": true, + "priority": 40 + }, + { + "name": [ + "-b", + "--dbpath" + ], + "description": "Specify an alternative database location", + "args": { + "name": "path", + "template": "filepaths" + } + }, + { + "name": [ + "-r", + "--root" + ], + "description": "Specify an alternative installation root", + "args": { + "name": "path", + "template": "filepaths" + } + }, + { + "name": [ + "-v", + "--verbose" + ], + "description": "Output paths such as the Root, Conf File, DB Path, Cache Dirs, etc" + }, + { + "name": "--arch", + "description": "Specify an alternate architecture", + "args": { + "name": "arch" + } + }, + { + "name": "--cachedir", + "description": "Specify an alternative package cache location", + "args": { + "name": "dir", + "template": "folders" + } + }, + { + "name": "--color", + "description": "Specify when to enable coloring", + "args": { + "name": "when" + } + }, + { + "name": "--config", + "description": "Specify an alternate configuration file", + "args": { + "name": "file", + "template": "filepaths" + } + }, + { + "name": "--debug", + "description": "Display debug messages" + }, + { + "name": "--gpgdir", + "description": "Specify a directory of files used by GnuPG to verify package signatures", + "args": { + "name": "dir", + "template": "folders" + } + }, + { + "name": "--logfile", + "description": "Specify an alternate log file (absolute path)", + "args": { + "name": "file", + "template": "filepaths" + } + }, + { + "name": "--hookdir", + "description": "Specify an alternative directory containing hook files", + "args": { + "name": "dir", + "template": "folders" + } + }, + { + "name": "--noconfirm", + "description": "Bypass any and all 'Are you sure?' messages" + }, + { + "name": "--confirm", + "description": "Cancels the effects of a previous --noconfirm" + }, + { + "name": "--disable-download-timeout", + "description": "Disable defaults for low speed limit and timeout on downloads" + }, + { + "name": "--sysroot", + "description": "Specify an alternative system root", + "args": { + "name": "dir", + "template": "folders" + } + }, + { + "name": "--repo", + "description": "Assume all targets are from the repositories" + }, + { + "name": [ + "-a", + "--aur" + ], + "description": "Assume all targets are from the AUR" + } + ] +} diff --git a/command-signatures/src/generators/mod.rs b/command-signatures/src/generators/mod.rs index 86d47462..fd9a4dbb 100644 --- a/command-signatures/src/generators/mod.rs +++ b/command-signatures/src/generators/mod.rs @@ -53,6 +53,7 @@ mod npm; mod nx; mod oc; mod pacman; +mod paru; mod pass; mod phpunit_watcher; mod pip; @@ -78,6 +79,7 @@ mod tmuxinator; mod tsh; mod uv; mod vagrant; +mod yay; mod yc; /// Used for gcloud and gsutil completions. @@ -118,7 +120,9 @@ pub fn dynamic_command_signature_data() -> HashMap CommandSignatureGenerators { +pub const LIST_PKG_TAR_FILES_COMMAND: &str = r#"find . -maxdepth 1 -type f -name '*.pkg.tar' -o -name '*.pkg.tar.zst' -o -name '*.pkg.tar.gz' -o -name '*.pkg.tar.xz'"#; + +/// Parses a newline-separated list of package names into suggestions. Used both for installed +/// packages (`pacman -Q` piped through `awk '{print $1}'`) and for available packages +/// (`pacman -Slq`, `yay -Pc`, `paru -Pc`), since all of those commands emit one package name per +/// line. +pub fn list_packages(output: &str) -> GeneratorResults { + let mut targets = Vec::new(); + for package_name in output.lines() { + if !package_name.is_empty() { + targets.push(Suggestion::with_description( + package_name.to_string(), + "package", + )); + } + } + targets.into_iter().collect_unordered_results() +} + +/// Parses the `find` output listing `.pkg.tar*` files in the current directory. These are +/// prioritized over installed/available packages, since a literal built package file is a +/// stronger completion signal than a bare package name. +pub fn list_pkg_tar_files_in_cwd(output: &str) -> GeneratorResults { + let mut targets = Vec::new(); + for file in output.lines() { + if !file.is_empty() { + targets.push( + Suggestion::with_description(file.to_string(), ".pkg.tar file") + .with_priority(Priority::most_important()), + ) + } + } + targets.into_iter().collect_unordered_results() +} + +/// Returns a generator that lists installed packages via `pacman -Q`. This is shared across +/// `pacman`, `yay`, and `paru`, since installed packages always live in the same pacman +/// database regardless of which frontend originally installed them; there is no need to shell +/// out to `yay`/`paru` themselves for this. +pub fn list_installed_packages_generator() -> Generator { + Generator::script( + CommandBuilder::pipe( + CommandBuilder::single_command("pacman -Q"), + CommandBuilder::single_command("awk '{print $1}'"), + ), + list_packages, + ) +} + +/// Returns a generator that lists `.pkg.tar*` files in the current directory, for `-U`/`--upgrade`. +/// Shared across `pacman`, `yay`, and `paru`, since none of them change how local package files +/// are named or discovered. +pub fn list_pkg_tar_files_in_cwd_generator() -> Generator { + Generator::script( + CommandBuilder::single_command(LIST_PKG_TAR_FILES_COMMAND), + list_pkg_tar_files_in_cwd, + ) +} + +pub fn pacman_generators() -> CommandSignatureGenerators { CommandSignatureGenerators::new("pacman") .add_generator( "list_installed_packages", - Generator::script(CommandBuilder::pipe(CommandBuilder::single_command(r#"pacman -Q"#), CommandBuilder::single_command(r#"awk '{print $1}'"#)), |output| { - let mut targets = Vec::new(); - for package_name in output.lines() { - targets.push(Suggestion::with_description( - package_name.to_string(), - "package", - )); - } - targets.into_iter().collect_unordered_results() - }), - ).add_generator( + list_installed_packages_generator(), + ) + .add_generator( "list_all_packages", - Generator::script(CommandBuilder::single_command("pacman -Slq"), |output| { - let mut targets = Vec::new(); - for package_name in output.lines() { - targets.push(Suggestion::with_description( - package_name.to_string(), - "package", - )); - } - targets.into_iter().collect_unordered_results() - }), + Generator::script(CommandBuilder::single_command("pacman -Slq"), list_packages), ) .add_generator( "list_all_pkg_tar_files_in_cwd", - Generator::script( - CommandBuilder::single_command(r#"find . -maxdepth 1 -type f -name '*.pkg.tar' -o -name '*.pkg.tar.zst' -o -name '*.pkg.tar.gz' -o -name '*.pkg.tar.xz'"#), - |output| { - // We should prioritize .pkg.tar files over the already installed packages. - let mut targets = Vec::new(); - for file in output.lines() { - if !file.is_empty() { - targets.push(Suggestion::with_description(file.to_string(), ".pkg.tar file").with_priority(Priority::most_important())) - } - } - targets.into_iter().collect_unordered_results() - }, - ), + list_pkg_tar_files_in_cwd_generator(), ) } diff --git a/command-signatures/src/generators/paru.rs b/command-signatures/src/generators/paru.rs new file mode 100644 index 00000000..df41ccf2 --- /dev/null +++ b/command-signatures/src/generators/paru.rs @@ -0,0 +1,34 @@ +/// `paru` is a pacman-compatible AUR helper: like `yay`, it wraps `pacman` for repository +/// packages and adds AUR support on top, using pacman's own CLI syntax (see `json/paru.json`, +/// modeled on `json/pacman.json`). +/// +/// See `super::yay` for the full rationale, which applies identically here: `paru -Pc` +/// (`paru --show --complete`) is paru's own purpose-built completion command ("Print a list of +/// all AUR and repo packages. This allows shell completion and is not intended to be used +/// directly by the user."), used by paru's own bundled completion scripts, and backed by a +/// locally refreshed cache so it stays fast for interactive use despite the AUR having well over +/// 100k packages. Installed-package and local `.pkg.tar` file completions shell out to `pacman` +/// directly, since that data doesn't depend on paru at all. Like yay, paru's completion cache +/// refreshes periodically (see `--completioninterval`, default 7 days) rather than on every +/// invocation. +use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; + +use super::pacman::{ + list_installed_packages_generator, list_packages, list_pkg_tar_files_in_cwd_generator, +}; + +pub fn paru_generators() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("paru") + .add_generator( + "list_installed_packages", + list_installed_packages_generator(), + ) + .add_generator( + "list_all_packages", + Generator::script(CommandBuilder::single_command("paru -Pc"), list_packages), + ) + .add_generator( + "list_all_pkg_tar_files_in_cwd", + list_pkg_tar_files_in_cwd_generator(), + ) +} diff --git a/command-signatures/src/generators/yay.rs b/command-signatures/src/generators/yay.rs new file mode 100644 index 00000000..4339635e --- /dev/null +++ b/command-signatures/src/generators/yay.rs @@ -0,0 +1,42 @@ +/// `yay` is a pacman-compatible AUR helper: it wraps `pacman` for repository packages and adds +/// AUR support on top, using pacman's own CLI syntax (see `json/yay.json`, modeled on +/// `json/pacman.json`). +/// +/// For enumerating *available* packages (`-S`/`--sync`), we can't just reuse pacman's +/// `pacman -Slq`, since that only lists repo packages and would reproduce the exact bug being +/// fixed here (no AUR completions). Instead we shell out to `yay -Pc` (`yay --show --complete`), +/// which yay's own man page describes as: "Print a list of all AUR and repo packages. This +/// allows shell completion and is not intended to be used directly by the user." It's also +/// exactly what yay's own bundled bash/zsh completion scripts use for this purpose. We prefer +/// it over querying the AUR RPC directly, since the AUR has well over 100k packages and +/// enumerating it live on every keystroke would be far too slow for interactive completion; +/// `-Pc` instead reads from yay's local completion cache, which it refreshes periodically (see +/// `--completioninterval`, default 7 days) rather than on every invocation. The tradeoff is +/// that the very first call (before any cache exists) can be slow while that cache is built, but +/// every completion after that is fast. +/// +/// For installed-package and local `.pkg.tar` file completions (`-Q`, `-R`, `-U`), we shell out +/// to `pacman` directly rather than `yay`, since those never touch the AUR: pacman's own +/// database is authoritative regardless of which frontend originally installed a package, and +/// there's no reason to pay yay's startup cost for data pacman already has. +use warp_completion_metadata::{CommandBuilder, CommandSignatureGenerators, Generator}; + +use super::pacman::{ + list_installed_packages_generator, list_packages, list_pkg_tar_files_in_cwd_generator, +}; + +pub fn yay_generators() -> CommandSignatureGenerators { + CommandSignatureGenerators::new("yay") + .add_generator( + "list_installed_packages", + list_installed_packages_generator(), + ) + .add_generator( + "list_all_packages", + Generator::script(CommandBuilder::single_command("yay -Pc"), list_packages), + ) + .add_generator( + "list_all_pkg_tar_files_in_cwd", + list_pkg_tar_files_in_cwd_generator(), + ) +} diff --git a/command-signatures/src/lib.rs b/command-signatures/src/lib.rs index b0a74f1d..9ebdb409 100644 --- a/command-signatures/src/lib.rs +++ b/command-signatures/src/lib.rs @@ -148,6 +148,40 @@ mod tests { } } + /// `all_referenced_generators_exist` only checks that a JSON-referenced generator name + /// exists *somewhere* in the global union of every command's generators, so it would still + /// pass even if `yay`/`paru` were dropped from `dynamic_command_signature_data()` entirely + /// (their `list_all_packages` name collides with pacman's). This test instead pins down the + /// per-command binding the yay/paru fix actually depends on: that looking up `yay`/`paru`'s + /// own dynamic data resolves `list_all_packages` to *their own* `-Pc` completion command, + /// not to pacman's `-Slq` (which would silently drop AUR results). + #[test] + fn yay_and_paru_bind_list_all_packages_to_their_own_completion_command() { + let generators = generators::dynamic_command_signature_data(); + + for (command_name, expected_command) in [("yay", "yay -Pc"), ("paru", "paru -Pc")] { + let dynamic_data = generators.get(command_name).unwrap_or_else(|| { + panic!("no dynamic completion data registered for command {command_name:?}") + }); + let generator = dynamic_data + .generators() + .get(&GeneratorName::new("list_all_packages")) + .unwrap_or_else(|| panic!("{command_name:?} has no `list_all_packages` generator")); + match &generator.process { + GeneratorProcess::ShellCommand(command) => { + assert_eq!( + command.build(Shell::Posix), + expected_command, + "{command_name:?}'s list_all_packages generator should run `{expected_command}`" + ); + } + GeneratorProcess::CommandFromTokens(_) => { + panic!("expected {command_name:?}'s list_all_packages generator to be a shell command") + } + } + } + } + /// Verify that all command signatures are well-formed JSON and valid for our deserialization /// schema. #[test]