metov / installcmd

Print correct command for installing a package.
1 stars 1 forks source link
cross-platform dotfiles hacktoberfest hacktoberfest2021 hacktoberfest2022 linux package-manager

installcmd

Cross platform package install commands.

I use a lot of cross platform software. One annoying thing about it is that every platform has its own package manager with a unique install command. What's even worse is that sometimes the packages themselves are listed under slightly different names in different repositories. Installcmd solves this by detecting your platform and providing the correct command.

Installation

Install with: pip install installcmd

Usage

Installcmd just prints the command, but it's easy to make your shell execute it:

# Without spec
$ $(installcmd) package-name

# With spec
$ $(installcmd pkgspec docker.yaml)

It's not magic. It searches through a built-in list of commands for various platforms (see contribution guide). The package name specs have to be provided by you (see package specs).

The main use of this is writing portable installation scripts, such as in your dotfiles repo or Dockerfiles. You can let installcmd handle the platform detection logic instead of having to reimplement it again and again, which makes the scripts a lot cleaner.