10 个版本 (重大更改)
0.8.0 | 2024年5月26日 |
---|---|
0.7.0 | 2024年3月24日 |
0.6.0 | 2024年3月18日 |
0.5.0 | 2023年12月22日 |
0.1.3 | 2019年4月2日 |
#268 在 命令行工具
每月28次下载
63KB
1.5K SLoC
UPT — Universal Package-management Tool
Upt 为任何操作系统提供了一个统一的命令接口来管理软件包。
Upt 依赖于平台上的软件包管理工具来执行任务,它更像是一个包装器或自适应别名。
安装
使用 Cargo
Upt是用 Rust 编写的,您可以使用 cargo 安装它。
cargo install upt
使用 Shell (Mac, Linux)
curl -fsSL https://raw.githubusercontent.com/sigoden/upt/main/install.sh | sh -s -- --to /usr/local/bin
适用于 macOS、Linux、Windows、BSD 的二进制文件
从 GitHub Releases 下载,解压并将 upt
添加到您的 $PATH。
特性
统一的命令接口
每个操作系统 (OS) 都有自己的软件包管理工具,需要不同的命令来完成相同的操作。在切换或尝试新的操作系统时可能会不方便。
apt install $pkg # Ubuntu, Debian, Linux Mint...
apk add $pkg # Alpine
pacman -S $pkg # Arch, Manjaro...
nix-env -i $pkg # Nixos
xbps-install $pkg # Voidlinux
emerge $pkg # Gentoo
使用 upt
,您只需记住一个命令
upt install $pkg # Works on any OS
Upt 识别操作系统类型,并运行适当的软件包管理工具安装 $pkg
。
作为另一个工具
Upt 可以作为另一个工具,并通过重命名来使用它们的语法。
cp upt brew
brew install $pkg
cp upt pacman
pacman -S $pkg
cp upt emerge
emerge $pkg
这样,您可以使用最熟悉的工具的语法来管理软件包。
支持的工具
| Tool | Install | Uninstall | Upgrade | Search | Info | Update Index | Upgrade All | List Installed |
| ----------- | --------------------------- | --------------------------- | ------------------------------- | --------------------- | ------------------------------ | ---------------------- | ------------------------ | --------------------------------- |
| upt | upt install $pkg | upt remove/uninstall $pkg | upt upgrade $pkg | upt search $pkg | upt info/show $pkg | upt update | upt upgrade | upt list |
| apk | apk add $pkg | apk del $pkg | apk upgrade $pkg | apk search $pkg | apk info $pkg | apk update | apk upgrade | apk list -I/--installed |
| apt | apt install $pkg | apt remove $pkg | apt install --only-upgrade $pkg | apt search $pkg | apt show $pkg | apt update | apt upgrade | apt list -i/--installed |
| brew | brew install $pkg | brew uninstall $pkg | brew upgrade $pkg | brew search $pkg | brew info $pkg | brew update | brew upgrade | brew list |
| cards | cards install $pkg | cards remove $pkg | cards install -u/--upgrade $pkg | cards search $pkg | cards info $pkg | cards sync | cards upgrade | cards list |
| choco | choco install $pkg | choco uninstall $pkg | choco upgrade $pkg | choco search $pkg | choco info $pkg | - | choco upgrade all | choco list |
| dnf | dnf install $pkg | dnf remove $pkg | dnf upgrade $pkg | dnf search $pkg | dnf info $pkg | dnf check-update | dnf update | dnf list --installed |
| emerge | emerge $pkg | emerge --depclean $pkg | emerge --update $pkg | emerge --search $pkg | emerge --info $pkg | emerge --sync | emerge -vuDN @world | qlist -lv |
| eopkg | eopkg install $pkg | eopkg remove $pkg | eopkg upgrade $pkg | eopkg search $pkg | eopkg info $pkg | eopkg update-repo | eopkg upgrade | eopkg list-installed |
| flatpak | flatpak install $pkg | flatpak uninstall $pkg | flatpak update $pkg | flatpak search $pkg | flatpak info $pkg | - | flatpak update | flatpak list |
| guix | guix install $pkg | guix remove $pkg | guix upgrade $pkg | guix search $pkg | guix show $pkg | guix refresh | guix upgrade | guix package -I/--list-installed |
| nix-env | nix-env -i/--install $pkg | nix-env -e/--uninstall $pkg | nix-env -u/--upgrade $pkg | nix-env -qaP $pkg | nix-env -qa --description $pkg | nix-channel --update | nix-env -u/--upgrade | nix-env -q/--query --installed |
| opkg | opkg install $pkg | opkg remove $pkg | opkg upgrade $pkg | opkg find $pkg | opkg info $pkg | opkg update | opkg upgrade | opkg list --installed |
| pacman | pacman -S $pkg | pacman -Rs $pkg | pacman -S $pkg | pacman -Ss $pkg | pacman -Si $pkg | pacman -Sy | pacman -Syu | pacman -Q |
| pkg | pkg install $pkg | pkg remove $pkg | pkg install $pkg | pkg search $pkg | pkg info $pkg | pkg update | pkg upgrade | pkg info -a/--all |
| pkg(termux) | pkg install $pkg | pkg uninstall $pkg | pkg install $pkg | pkg search $pkg | pkg show $pkg | pkg update | pkg upgrade | pkg list-installed |
| pkgman | pkgman install $pkg | pkgman uninstall $pkg | pkgman update $pkg | pkgman search $pkg | - | pkgman refresh | pkgman update | pkgman search -i -a |
| prt-get | prt-get install $pkg | prt-get remove $pkg | prt-get update $pkg | prt-get search $pkg | prt-get info $pkg | ports -u | prt-get sysup | prt-get listinst |
| scoop | scoop install $pkg | scoop uninstall $pkg | scoop update $pkg | scoop search $pkg | scoop info $pkg | scoop update | scoop update * | scoop list |
| slackpkg | slackpkg install $pkg | slackpkg remove $pkg | slackpkg upgrade $pkg | slackpkg search $pkg | slackpkg info $pkg | slackpkg update | slackpkg upgrade-all | ls -1 /var/log/packages |
| snap | snap install --classic $pkg | snap remove $pkg | snap refresh $pkg | snap find $pkg | snap info $pkg | - | snap refresh | snap list |
| urpm | urpmi $pkg | urpme $pkg | urpmi $pkg | urpmq -y/--fuzzy $pkg | urpmq -i $pkg | urpmi.update -a | urpmi --auto-update | rpm -q/--query --all |
| winget | winget install $pkg | winget uninstall $pkg | winget upgrade $pkg | winget search $pkg | winget show $pkg | - | winget upgrade --all | winget list |
| xbps | xbps-install $pkg | xbps-remove $pkg | xbps-install -u/--update $pkg | xbps-query -Rs $pkg | xbps-query -RS $pkg | xbps-install -S/--sync | xbps-install -u/--update | xbps-query -l/--list-pkgs |
| yum | yum install $pkg | yum remove $pkg | yum upgrade $pkg | yum search $pkg | yum info $pkg | yum check-update | yum update | yum list --installed |
| zypper | zypper install $pkg | zypper remove $pkg | zypper update $pkg | zypper search $pkg | zypper info $pkg | zypper refresh | zypper update | zypper search -i/--installed-only |
操作系统工具
+------------------------------------------------------+----------------------+
| OS | Tools |
+------------------------------------------------------+----------------------+
| windows | scoop, choco, winget |
+------------------------------------------------------+----------------------+
| macos | brew, port |
+------------------------------------------------------+----------------------+
| ubuntu, debian, linuxmint, pop, deepin, elementary | apt |
| kali, raspbian, aosc, zorin, antix, devuan, bodhi | |
| lxle, sparky | |
+------------------------------------------------------+----------------------+
| fedora, redhat, rhel, amzn, ol, almalinux, rocky | dnf, yum |
| oubes, centos, qubes, eurolinux | |
+------------------------------------------------------+----------------------+
| arch, manjaro, endeavouros, arcolinux, garuda | pacman |
| antergos, kaos | |
+------------------------------------------------------+----------------------+
| alpine, postmarket | apk |
+------------------------------------------------------+----------------------+
| opensuse, opensuse-leap, opensuse-tumbleweed | zypper |
+------------------------------------------------------+----------------------+
| nixos | nix-env |
+------------------------------------------------------+----------------------+
| gentoo, funtoo | emerge |
+------------------------------------------------------+----------------------+
| void | xbps |
+------------------------------------------------------+----------------------+
| mageia | urpm |
+------------------------------------------------------+----------------------+
| slackware | slackpkg |
+------------------------------------------------------+----------------------+
| solus | eopkg |
+------------------------------------------------------+----------------------+
| openwrt | opkg |
+------------------------------------------------------+----------------------+
| nutyx | cards |
+------------------------------------------------------+----------------------+
| crux | prt-get |
+------------------------------------------------------+----------------------+
| freebsd, ghostbsd | pkg |
+------------------------------------------------------+----------------------+
| android | pkg(termux) |
+------------------------------------------------------+----------------------+
| haiku | pkgman |
+------------------------------------------------------+----------------------+
| windows/msys2 | pacman |
+------------------------------------------------------+----------------------+
| * | apt, dnf, pacman |
+------------------------------------------------------+----------------------+
Upt 将根据上述表格确定使用哪个软件包管理工具。
某些平台可能支持多个软件包管理工具,Upt 将按顺序选择其中一个。
您可以通过设置 UPT_TOOL
环境变量来指定 UPT 应使用的软件包管理器。
UPT_TOOL=brew upt install $pkg # equal to `brew install $pkg`
UPT_TOOL=nix-env upt install $pkg # equal to `nix-env -i $pkg`
许可证
版权所有 (c) 2023-∞ upt-developers。
Upt 可在 MIT 许可证或 Apache 许可证 2.0 的条款下提供,任选其一。
有关许可证详细信息,请参阅 LICENSE-APACHE 和 LICENSE-MIT 文件。
依赖关系
~2–10MB
~119K SLoC