-
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 many Linux distributions. 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)
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). There are appimages, flatpaks and snaps, pip, npm, homebrew and linux brew, to name a few. The default package managers won't know about most of this stuff. -
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.
Yes, I've already done some tests with snap
, npm
and pip
and these will be quite easy to integrate. I expect flatpak
and homebrew
/linux brew
will be possible too.