Awesome
Upt — Universal Package-management Tool.
English | 简体中文
Features
Unified Command
Each OS has its own package management tool. To complete the same operation, you need to enter different commands.
For example, we need to get an updatable package, We have to execute the following command:
apt list --upgradable # Ubuntu, Debian, Linux Mint...
yum list updates # Centos, Redhat...
brew outdated # MacOS Homebrew
apk list --upgrades # Alpine
pacman -Qu # Arch, Manjaro...
choco outdated # Windows Chocolatey
dnf list --upgrades # Fedora
This brings us a lot of inconvenience in switching and experiencing the new OS. After all, package management is a essential and common operation.
upt
can solve this problem. It can run on various platforms and even in various distributions, provided Unified Command to execute the package management operations.
upt list -u # All in one command
UPT only provides a unified interface, and the package management function is implemented by calling the system's native tools.
Command Replacement
Everyone has their familiar operating system and package management tool.
People who use MacOS may be familiar with the brew
command, People who use Windows may be familiar with the choco
command, People who use Ubuntu may be familiar with the apt
command。
In order to use upt
, you have to learn upt
command, which is not easy. Fortunately, upt
supports command replacement. You do not need to learn a new command.
If you are a person familiar with brew
, when you have to manage the package in Ubuntu, you can download the upt
command. By rename upt to brew
. You can use brew
-style for package management in Ubuntu.
cp upt brew
brew install wget # upt will work like brew
Many supported package management tools
- apk
- apt
- brew
- choco
- scoop
- dnf
- pacman
- yum
Install
Download Binary
Binary are available for download Releases . Make sure to put the path to the binary into your PATH
.
mv upt /usr/local/bin # Linux, MacOS
:: Windows, Run as administrator
move upt C:\Windows\System32
Use Cargo
upt
is written in the rust language and posted to crates. So you can install it using cargo.
# curl https://sh.rustup.rs -sSf | sh # 安装 cargo
cargo install upt
Usage
- Install packages
upt install vim # install a single package
upt install vim ripgrep # install multiple packages
upt install -y vim # assume yes when installing
- Remove packages
upt remove vim # remove a single package
upt remove vim ripgrep # remove multiple packages
upt remove -y vim # assume yes when removing
- Upgrade packages
upt upgrade vim # upgrade a single package
upt upgrade vim ripgrep # upgrade multiple packages
upt upgrade -y vim # assume yes when upgrading
- Search for package
upt search vim
- Show package details
upt show vim
- Update indexes of packages
upt update
- Upgrade all packages
upt upgrade
upt upgrade -y # assume yes when upgrading
- List all upgradable packages
upt list -i
- List all installed packages
upt list -u
If you feel
upt
should support a package management operation, feel free to create issue to discuss it.
Command Replacement Table
The upt
executable file is small, but it needs to be universal across the platform. It is impossible to embed package management function.
upt
implements package management functions by calling the system's native tools. So upt
is essentially an interpreter.
When you run upt
in Ubuntu:
- Input
upt list -u
- After parsing,
upt
find that you are going to execute task: `list all updatable packages'. upt
detects theapt
package management tool used by your system.upt
interpret the tasklist all updatable packages
toapt
command.- Run
apt list --upgradable
.
If you rename upt
to brew
, upt
will use the brew
syntax to resolve the task. Command Replacement is implemented this way.
The following table is the input and output mapping:
| task | upt | apt | brew | choco | yum | dnf | pacman | apk |
| :--------------------------- | :--------------- | :-------------------- | :------------------ | :------------------- | :----------------- | :------------------- | :-------------- | :------------------- |
| Install packages | upt install $pkg | apt install $pkg | brew install $pkg | choco install $pkg | yum install $pkg | dnf install $pkg | pacman -S $pkg | apk add $pkg |
| Remove packages | upt remove $pkg | apt remove $pkg | brew uninstall $pkg | choco uninstall $pkg | yum remove $pkg | dnf remove $pkg | pacman -Rs $pkg | apk del $pkg |
| Upgrade packages | upt upgrade $pkg | apt install $pkg | brew upgrade $pkg | choco upgrade $pkg | yum update $pkg | dnf upgrade $pkg | pacman -S $pkg | apk upgrade $pkg |
| Search for package | upt search $pkg | apt search $pkg | brew search $pkg | choco search $pkg | yum search $pkg | dnf search $pkg | pacman -Ss $pkg | apk search $pkg |
| Show package details | upt show $pkg | apt show $pkg | brew info $pkg | choco info $pkg | yum info $pkg | dnf info $pkg | pacman -Si $pkg | apk info $pkg |
| Update indexes of packages | upt update | apt update | brew update | choco upgrade --noop | yum check-update | dnf check-update | pacman -Syy | apk update |
| Upgrade all packages | upt upgrade | apt upgrade | brew upgrade | choco upgrade all | yum update | dnf upgrade | pacman -Syu | apk upgrade |
| List all upgradable packages | upt list -u | apt list --upgradable | brew outdated | choco outdated | yum list updates | dnf list --upgrades | pacman -Qu | apk list --upgrades |
| List all installed packages | upt list -i | apt list --installed | brew list | choco list -lai | yum list installed | dnf list --installed | pacman -Qe | apk list --installed |
The table also lists:
- commands that can be replaced
- Supported package management tools
- Syntax for inter-command conversion
If you find errors or want to add other package management tools, please issue.
License
Copyright (c) 2019 sigoden
Licensed under the MIT license.