Retrieve all printers from a CUPS server. It's a simple command-line tool that allows one to output the existing printers or write them to a file.
It may require that the development package for CUPS is installed, e.g.
$ sudo dnf -y install cups-devel
.
The package is hosted on PyPI.
It depends on typer
and pycups
.
$ pip install cups_printer
For Nix or NixOS users is a package
available in Nixpkgs. Keep in mind that the lastest releases might only
be present in the unstable
channel.
$ nix-env -iA nixos.cups-printers
$ python3 -m venv
$ source bin/activate
$ python3 setup.py
The default CUPS instance which is used is localhost
.
$ cups-printers --help
Usage: cups-printers [OPTIONS] COMMAND [ARGS]...
╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --server TEXT The server URL of CUPS instance [env var: CUPS_SERVER] [default: localhost:631] │
│ --timeout TEXT Timeout for network operations [env var: TIMEOUT] [default: 5] │
│ --install-completion Install completion for the current shell. │
│ --show-completion Show completion for the current shell, to copy it or customize the installation. │
│ --help Show this message and exit. │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ output │
│ queue │
│ state │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
To get the details from a remote CUPS instance, use --server
.
$ cups-printers --server 192.168.191.1:631 output json
cups-printers
ìs license under MIT.