-
Notifications
You must be signed in to change notification settings - Fork 11
Package Manager Integration
In addition to maintaining a list of known version flags, version
also integrates with the package managers on Linux and Macos. If the command that you pass to version
is not in the list of known tools, it will then try to find it via one of the three most common package managers:
-
apt
(Debian, Ubuntu, and derivatives) -
pacman
(Arch, Manjaro, and derivatives) -
dnf
(Fedora and derivatives) -
snap
(Linux) -
npm
(Mac and Linux) -
pip
(Mac and Linux) -
flatpak
(Linux) -
brew
(Mac and Linux) -
macports
(Mac)
It queries the package manager for the name of the tool in the list of packages that the package manager knows about. If the package is found, version
knows how to parse the version number out of the metadata returned.
This brings the number of tools that version
can report on into the thousands. It also lets it report the versions of hundreds of non-executable libraries, etc. that do not even have version flags.
A couple of reasons.
-
Package managers aren't the only way to install software. You can just download an executable and put it in your path. You can build from source. There is software with install scripts (like
version
itself) and there are appimages. All of these (and other methods) will bypass existing package managers, but ifversion
knows about them, it will be able to report their version. And if it doesn't know about them, it can be taught. -
There could be cases where the package manager has installed a particular program, and then another version was installed via a different method. If
version
knows about that program, it will likely give a more accurate version number, because it will be calling the first program it finds in the path, which is what will be found and called most other ways you would execute that program.
Potentially...
- Fink - MacOS
- ZYpp - OpenSUSE
- Portage - Gentoo
- Nix - Nix
What did we miss?