Skip to main content

A plugin-based CLI wrapper ecosystem for common command-line tools

Project description

swisscli

A plugin-based CLI wrapper ecosystem for common command-line tools. swisscli wraps native tools like curl, wget, openssl, ssh-keygen, apt, dnf, yum, dpkg, and rpm, providing consistent argument naming, subcommand interfaces, and automatic fallback between tools in the same category.

Installation

git clone https://github.com/agonzalezrh/swisscli.git
cd swisscli
pip install .

Or install directly:

pip install swisscli

Usage

swisscli --help                    # list tools grouped by category
swisscli --version                 # show version
swisscli <tool> --help             # tool-specific help
swisscli <tool> <subcommand> --help  # subcommand details
swisscli <tool> [ARGS]...          # run a tool

Available tools

web-cli

Tool Description
curl HTTP requests with long-flag aliases (--insecure-k, --silent-s, --location-L, etc.)
wget File downloads with long-flag aliases (--insecure--no-check-certificate, --quiet-q, etc.)
swisscli curl --insecure --location https://example.com
swisscli wget --output file.zip https://example.com/file.zip

ssl

Tool Subcommands Description
openssl show, generate OpenSSL certificate toolkit
ssh-keygen show, generate SSH key management tool
swisscli openssl show cert.pem
swisscli openssl generate --days 730 --out mycert.pem
swisscli ssh-keygen show ~/.ssh/id_rsa
swisscli ssh-keygen generate --type ed25519 --file mykey

package

Tool Subcommands Description
apt install, remove, search, list Debian/Ubuntu package manager
dnf install, remove, search, list RPM package manager (modern)
yum install, remove, search, list RPM package manager (legacy)
dpkg list, info, search, contents Debian low-level package manager
rpm list, info, search, files RPM low-level package manager
swisscli apt install curl
swisscli apt remove --purge firefox
swisscli apt search build-essential
swisscli dpkg list
swisscli dpkg info bash
swisscli rpm list
swisscli rpm files coreutils

Fallback behavior

If a tool binary is not found on the system, swisscli automatically falls back to another tool in the same category. For example, running swisscli dnf install curl on a Debian system will fall back to apt install curl. The fallback notice is printed to stderr.

Adding your own plugin

Create a file at src/swisscli/plugins/<category>/<tool>.py. Define a Plugin subclass with a name, description, and category. Export a module-level plugin = MyPlugin() instance — auto-discovery picks it up on next run.

Two patterns:

  • Simple flag mapping — override arg_mapper for long-flag aliases
  • Subcommand-based — override subcommands dict with Subcommand objects (prefix args, suffix args, optional arg mapper)

Architecture

  • Plugin — base class wrapping a CLI tool (argument mapping, execution, fallback)
  • ArgMapper — translates user-friendly long flags to native tool flags
  • Subcommand — defines prefix/suffix args injected between tool name and user args
  • PluginRegistry — singleton registry discovered automatically via pkgutil.walk_packages
  • Categories — plugins grouped by domain; fallback operates within the same category

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

swisscli-0.1.0.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swisscli-0.1.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file swisscli-0.1.0.tar.gz.

File metadata

  • Download URL: swisscli-0.1.0.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for swisscli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9d9f0ecfd526361371d4cec09f19d092de11372603c55cedf164c62b54088555
MD5 18f4b19651fe6053cfae01dad20d53e5
BLAKE2b-256 522a3f820c96bc253f476b66d0bfd45f822de0d3e85f37590e6e9eff7d6b18ea

See more details on using hashes here.

File details

Details for the file swisscli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: swisscli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for swisscli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ce7dca927e5bbbcd54fe4f2c94af619519b3e34dbd3827c343d181a5dc34dd63
MD5 373c35f421ac035bfb764d3df92c2cda
BLAKE2b-256 8e761dbc0b4a8df08fb98d4bbc2993e8ebca4abe7de3abb9ae889517e08abe85

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page