From eaf2d9272588191921c75cf2c8a9d406dc5d7a41 Mon Sep 17 00:00:00 2001 From: sigoden Date: Sun, 10 Dec 2023 07:37:57 +0000 Subject: [PATCH] chore: update readme and vendors! --- README.md | 124 +++++++++++++++++++++++--------------------------- src/vendor.rs | 30 ++++++------ 2 files changed, 73 insertions(+), 81 deletions(-) diff --git a/README.md b/README.md index 9bcceae..a38574c 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,20 @@ Upt relies on platform's package management tool to do the job, it is more like [![Build status](https://github.com/sigoden/upt/actions/workflows/ci.yml/badge.svg)](https://github.com/sigoden/upt/actions) [![Crates.io](https://img.shields.io/crates/v/upt.svg)](https://crates.io/crates/upt) +## Install + +**Use Cargo** + +Upt is written in the rust you can install it using [cargo](https://doc.rust-lang.org/stable/cargo/). + +```sh +cargo install upt +``` + +**Binaries for macOS, Linux, Windows, BSD** + +Download from [GitHub Releases](https://github.com/sigoden/upt/releases), unzip and add `upt` to your $PATH. + ## Features ### Unified command interface @@ -27,53 +41,60 @@ xbps-remove $pkg # Voidlinux With `upt`, You just need to remember one command: ```sh -upt remove $pkg # Works on any OS +upt remove $pkg # Works on any OS ``` +Upt identifies the os type and runs the appropriate package management tool to install `$pkg`. + ### Act as other command -Upt can act as other commands and use their syntax by renaming. +Upt can act as other command and use their syntax by renaming. ```sh cp upt brew -brew install vim # use brew syntax to install a package +brew install $pkg cp upt pacman -pacman -S vim # use pacman syntax to install a package +pacman -S $pkg + +cp upt emerge +emerge $pkg ``` +In this way, you can use the syntax of the tool you are most familiar with to manage packages. + ### Supported Tools ``` -| Tool | Install | Uninstall | Upgrade | Search | Info | Update Index | Upgrade All | List Installed | -| -------- | ---------------------------- | ---------------------------- | -------------------------------- | -------------------------- | ------------------------------- | ------------------------ | ------------------------ | --------------------------------- | -| apk | apk add | apk del | apk upgrade | apk search | apk info | apk update | apk upgrade | apk list -I/--installed | -| apt | apt install | apt remove | apt install --only-upgrade | apt search | apt show | apt update | apt upgrade | apt list -i/--installed | -| brew | brew install | brew uninstall | brew upgrade | brew search | brew info | brew update | brew upgrade | brew list | -| cards | cards install | cards remove | cards install -u/--upgrade | cards search | cards info | cards sync | cards upgrade | cards list | -| choco | choco install | choco uninstall | choco upgrade | choco search | choco info | choco upgrade all --noop | choco upgrade all | choco list -l/--local-only | -| dnf | dnf install | dnf remove | dnf upgrade | dnf search | dnf info | dnf check-update | dnf update | dnf list --installed | -| emerge | emerge | emerge --deselect | emerge --update | emerge --search | emerge --info | emerge --sync | emerge -vuDN @world | qlist -lv | -| eopkg | eopkg install | eopkg remove | eopkg upgrade | eopkg search | eopkg info | eopkg update-repo | eopkg upgrade | eopkg list-installed | -| flatpak | flatpak install | flatpak uninstall | flatpak update | flatpak search | flatpak info | - | flatpak update | flatpak list | -| guix | guix install | guix remove | guix upgrade | guix search | guix show | guix refresh | guix upgrade | guix package -I/--list-installed | -| nix-env | nix-env -i/--install | nix-env -e/--uninstall | nix-env -u/--upgrade | nix-env -qaP | nix-env -qa --description | nix-channel --update | nix-env -u/--upgrade | nix-env -q/--query --installed | -| opkg | opkg install | opkg remove | opkg upgrade | opkg find | opkg info | opkg update | opkg upgrade | opkg list --installed | -| pacman | pacman -S | pacman -Rs | pacman -S | pacman -Ss | pacman -Si | pacman -Syy | pacman -Syu | pacman -Qe | -| pkg | pkg install | pkg remove | pkg install | pkg search | pkg info | pkg update | pkg upgrade | pkg info -a/--all | -| pkg(2) | pkg install | pkg uninstall | pkg install | pkg search | pkg show | pkg update | pkg upgrade | pkg list-installed | -| scoop | scoop install | scoop uninstall | scoop update | scoop search | scoop info | scoop update | scoop update * | scoop list | -| slackpkg | slackpkg install | slackpkg remove | slackpkg upgrade | slackpkg search | slackpkg info | slackpkg update | slackpkg upgrade-all | ls -1 /var/log/packages | -| snap | snap install --classic | snap remove | snap refresh | snap find | snap info | - | snap refresh | snap list | -| upt | upt install | upt remove | upt upgrade | upt search | upt info | upt update | upt upgrade | upt list | -| urpm | urpmi | urpme | urpmi | urpmq -y/--fuzzy | urpmq -i | urpmi.update -a | urpmi --auto-update | rpm -q/--query --all | -| winget | winget install | winget uninstall | winget upgrade | winget search | winget show | - | winget upgrade --all | winget list | -| xbps | xbps-install | xbps-remove | xbps-install -u/--update | xbps-query -Rs | xbps-query -RS | xbps-install -S/--sync | xbps-install -u/--update | qxbps-query -l/--list-pkgs | -| yum | yum install | yum remove | yum upgrade | yum search | yum info | yum check-update | yum update | yum list --installed | -| zypper | zypper install | zypper remove | zypper update | zypper search | zypper info | zypper refresh | zypper update | zypper search -i/--installed-only | +| Tool | Install | Uninstall | Upgrade | Search | Info | Update Index | Upgrade All | List Installed | +| -------- | --------------------------- | --------------------------- | ------------------------------- | -------------------------- | ------------------------------ | ------------------------ | ------------------------ | --------------------------------- | +| upt | upt install $pkg | upt remove $pkg | upt upgrade $pkg | upt search $pkg | upt info $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 --noop | choco upgrade all | choco list -l/--local-only | +| 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 --deselect $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 -Syy | pacman -Syu | pacman -Qe | +| 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(2) | pkg install $pkg | pkg uninstall $pkg | pkg install $pkg | pkg search $pkg | pkg show $pkg | pkg update | pkg upgrade | pkg list-installed | +| 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 | slackpkg remove | slackpkg upgrade | slackpkg search | slackpkg info | 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 | qxbps-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 | ``` -### Known OSs +### OSs ``` +------------------------------------------------------+----------------------+ @@ -115,48 +136,19 @@ pacman -S vim # use pacman syntax to install a package +------------------------------------------------------+----------------------+ | freebsd, ghostbsd | pkg | +------------------------------------------------------+----------------------+ -| android | pkg(2) | +| android | pkg(termux) | ++------------------------------------------------------+----------------------+ +| * | apt, dnf, pacman | +------------------------------------------------------+----------------------+ ``` Some platforms may support multiple package management tools, and upt selects one of them in the order listed in the table. - -You can also use the environment variable `UPT_TOOL` to specify the package management tool instead of letting upt automatically determine it. +You can specify the package manager that UPT should use by setting the `UPT_TOOL` environment variable. ```sh -UPT_TOOL=nix upt install vim # use nix-env to install vim -UPT_TOOL=snap upt install vim # use snap to install vim -``` - -## Install - -**Use Cargo** - -Upt is written in the rust you can install it using [cargo](https://doc.rust-lang.org/stable/cargo/). - -```sh -cargo install upt -``` - -**Binaries for macOS, Linux, Windows, BSD** - -Download it from [GitHub Releases](https://github.com/sigoden/upt/releases), unzip and add `upt` to your $PATH. - -## Usage - -``` -Usage: - upt install Install packages - upt remove Remove packages - upt upgrade Upgrade packages - upt search Search for packages - upt info Show package details - upt update Update package indexes - upt upgrade Upgrade all packages - upt list List all installed packages - -Automatically confirm the action with: -y/--yes +UPT_TOOL=snap upt install $pkg # run snap to install $pkg +UPT_TOOL=nix-env upt install $pkg # run nix-env to install $pkg ``` ## License diff --git a/src/vendor.rs b/src/vendor.rs index a364358..dcace8a 100644 --- a/src/vendor.rs +++ b/src/vendor.rs @@ -68,11 +68,23 @@ os_tools!( // pkg "freebsd" => "pkg"; "ghostbsd" => "pkg"; - // pkg(2) - "andorid" => "pkg(2)" + // pkg(termux) + "andorid" => "pkg(termux)" ); vendors![ + { + name: "upt", + confirm: "-y/--yes", + install: "upt install $", + remove: "upt remove $", + upgrade: "upt upgrade $", + search: "upt search $", + info: "upt info $", + update_index: "upt update", + upgrade_all: "upt upgrade", + list_installed: "upt list", + }, { name: "apk", confirm: "", @@ -242,7 +254,7 @@ vendors![ list_installed: "pkg info -a/--all", }, { - name: "pkg(2)", + name: "pkg(termux)", confirm: "-y/--yes", install: "pkg install $", remove: "pkg uninstall $", @@ -289,18 +301,6 @@ vendors![ upgrade_all: "snap refresh", list_installed: "snap list", }, - { - name: "upt", - confirm: "-y/--yes", - install: "upt install $", - remove: "upt remove $", - upgrade: "upt upgrade $", - search: "upt search $", - info: "upt info $", - update_index: "upt update", - upgrade_all: "upt upgrade", - list_installed: "upt list", - }, { name: "urpm", confirm: "",