Skip to content

Latest commit

 

History

53 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pm

Wrapper around various package managers with unified CLI.

  • Supports: pacman, paru, yay, apt, dnf, zypper, apk, brew, scoop.
  • Interactive package selection using fzf with package info preview.
  • A single self-contained script. Just copy it somewhere on the $PATH and you're good to go.
  • POSIX compliant (will run literally everywhere, including Termux).

Demo usage

Usage

Run pm help for the usage:

Package manager wrapper (supports: paru yay pacman apt dnf zypper apk brew scoop)

Usage: pm <command>

Commands:
  i,  install          Interactively select packages to install.
  i,  install <pkg>... Install one or more packages.
  r,  remove           Interactively select packages to remove.
  r,  remove <pkg>...  Remove one or more packages.
  u,  upgrade          Upgrade all installed packages.
  f,  fetch            Update local package database.
  n,  info <pkg>       Print package information.
  la, list all         List all packages.
  li, list installed   List installed packages.
  sa  search all       Interactively search between all packages.
  si  search installed Interactively search between installed packages.
  w,  which            Print which package manager is being used.
  h,  help             Print this help.

Installation

For the current user

Asuming ~/.local/bin directory exists and is configured in the $PATH:

curl -o ~/.local/bin/pm https://github.com/ghraw/jpikl/pm/refs/heads/master/pm
chmod +x ~/.local/bin/pm

For all users

sudo curl -o /usr/local/bin/pm https://github.com/ghraw/jpikl/pm/refs/heads/master/pm
sudo chmod +x /usr/local/bin/pm

For Termux

curl -o /data/data/com.termux/files/usr/bin/pm https://github.com/ghraw/jpikl/pm/refs/heads/master/pm
chmod +x /data/data/com.termux/files/usr/bin/pm

Features

Interactive search

When running the install or remove commands without a particular package name, you will be offered an interactive package search via fzf.

This requires fzf to be installed first (pm install fzf).

AUR helpers

On Arch Linux, pm allows easy installation of selected AUR helpers.

Just run pm install <aur-helper> where <aur-helper> is one of paru, yay or their binary variant (paru-bin, yay-bin).

These AUR helpers will be then used as the prefered package manager over pacman.

Configuration

Configuration is done through the following environment variables

PM

Enforces use of a specific package manager.

Options: paru, yay, pacman, apt, dnf, zypper, apk, brew, scoop.

The default package manager is auto detected by checking availability of the binaries listed above (in that particular order).

pm install "<package>"           # Auto detect package manager
PM=pacman pm install "<package>" # Use pacman
PM=yay pm install "<package>"    # Use yay

PM_SUDO

Controls which program is used to run operations as root.

PM_SUDO=sudo-rs pm install "<package>" # Use alternative sudo command
PM_SUDO=doas pm install "<package>"    # Use alternative sudo command
PM_SUDO= pm install "<package>"        # Disable execution as root

The default value is sudo. In case the sudo binary is not available, pm checks for alternatives like sudo-rs or doas.

When running inside Termux, the execution as root is disabled by default (unless PM_SUDO is explicitly set).

PM_COLOR

Controls color output for non-interactive commands.

Options: auto, always, never.

The default value is auto which outputs colors only when STDOUT is a TTY.

FAQ

How to select multiple packages in interactive mode?

Use the TAB key to (un)select multiple packages.

See fzf docs for more keyboard shortcuts.

Is this better than my package manager?

Probably not, but it could be more convenient in some cases:

  1. If you often switch between distros and you do not want to remember every package manager CLI.
  2. Interactive package selection really helps when you are searching for a package to install and you do not know the exact name.

Can you support package manager XYZ?

Just create an issue for the support and I will look into that.

License

pm is licensed under the MIT license.

About

Package manager wrapper (supports: pacman, paru, yay, apt, dnf, zypper, apk, brew, scoop)

Topics

Resources

Stars

16 stars

Watchers

4 watching

Forks

Contributors

Languages