o2switch-cli
CLI interactif pour gerer domaines, sous-domaines cPanel et enregistrements DNS sur un hebergement o2switch/cPanel.
Version actuelle: 0.1.0
Installation
./install.sh
The installer:
- Creates a local virtual environment
- Installs the CLI and dependencies
- Prompts for cPanel credentials (stored in
~/.config/o2switch-cli/.env) - Publishes
o2switch-clito~/.local/bin - Installs bash completion
After install, reload your shell:
source ~/.bashrc && hash -r
Non-interactive install
./install.sh --cpanel-host saule.o2switch.net --cpanel-user myuser --cpanel-token mytoken
Development install
./install.sh --dev
Skip setup wizard
./install.sh --skip-setup
o2switch-cli config init # configure later
Uninstall
./uninstall.sh
./uninstall.sh --purge-venv --purge-config --purge-state
Configuration
Credentials are stored globally in ~/.config/o2switch-cli/.env and loaded automatically.
# Show current config and where it's loaded from
o2switch-cli config show
# Show config file paths (active, global, local)
o2switch-cli config path
# Re-run setup wizard
o2switch-cli config init
# Test API access
o2switch-cli config test
Config file locations
- Local
.envin current directory (takes precedence) - Global
~/.config/o2switch-cli/.env(default)
Environment variables
You can also set credentials via environment variables:
export O2SWITCH_CLI_CPANEL_HOST=saule.o2switch.net
export O2SWITCH_CLI_CPANEL_USER=myuser
export O2SWITCH_CLI_CPANEL_TOKEN=mytoken
Getting a cPanel API token
- Log into cPanel
- Go to Security > Manage API Tokens
- Create a new token with appropriate permissions
- Copy the token (it's only shown once)
Usage
o2switch-cli # Interactive mode (if TTY)
o2switch-cli --help # Show all commands
DNS Records
# Point a hostname to an IP (create or update A record)
o2switch-cli dns upsert --host staging.example.com --ip 203.0.113.25
# With explicit zone and custom TTL
o2switch-cli dns upsert --zone example.com --host staging --ip 203.0.113.25 --ttl 600
# Search DNS records
o2switch-cli dns search example
# Delete an A record
o2switch-cli dns delete --host staging.example.com
# Verify DNS resolution
o2switch-cli dns verify --host staging.example.com --ip 203.0.113.25
# Dry run (show what would change without applying)
o2switch-cli dns upsert --host staging.example.com --ip 203.0.113.25 --dry-run
Domains
o2switch-cli domains list
o2switch-cli domains list --page 2 --page-size 10
Subdomains
o2switch-cli subdomains create --root example.com --label staging --ip 203.0.113.25
o2switch-cli subdomains list
o2switch-cli subdomains delete --fqdn staging.example.com
Output formats
o2switch-cli domains list --json
o2switch-cli config show --json
Interactive mode includes loading spinners, real-time search suggestions, and paginated navigation.
Versioning
o2switch-cli suit Semantic Versioning.
- format:
MAJOR.MINOR.PATCH - version actuelle:
0.1.0 - tags de release:
vMAJOR.MINOR.PATCH - changelog:
CHANGELOG.md - politique detaillee:
VERSIONING.md
Regles de bump:
MAJOR: rupture de compatibilite sur la CLI, la sortie JSON stable, les comportements de mutation, ou les variables/configs publiquesMINOR: nouvelles commandes, nouvelles options retro-compatibles, nouveaux workflows ou nouveaux champs JSON optionnelsPATCH: corrections retro-compatibles, docs, tests, durcissement interne sans rupture contractuelle
Tant que le projet reste en 0.x, un bump MINOR peut encore embarquer des changements cassants. Les correctifs PATCH doivent rester retro-compatibles.
Source de verite:
- version package:
o2switch_cli/__init__.py - metadata build:
pyproject.tomllit cette version dynamiquement
Avant une release, mettre a jour le changelog, verifier o2switch-cli --version, puis tagger le commit avec vX.Y.Z.
Development
.venv/bin/ruff check .
.venv/bin/ruff format .
.venv/bin/pytest
Specs
Le pack de specifications projet est dans docs/specs/README.md.
Metadata
Release files for o2switch-cli 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| o2switch_cli-0.1.4.tar.gz | 46.2 kB | Without provenance | Details for o2switch_cli-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| o2switch_cli-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for o2switch_cli-0.1.4-py3-none-any.whl |
Total release size: 91.5 kB
Release files / o2switch_cli-0.1.4.tar.gz
| Download URL | o2switch_cli-0.1.4.tar.gz |
|---|---|
| Size | 46.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c911a3202d9bd163fa61dccb6a54850e7c365c6a82649bbfead48eeef4f8d0de
|
|
BLAKE2b-256 checksum How to use checksums |
99cd2fd5c675352f27eaff5cb4a7ab76a9dcb085465e0dc28c859f9f00a45955
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / o2switch_cli-0.1.4-py3-none-any.whl
| Download URL | o2switch_cli-0.1.4-py3-none-any.whl |
|---|---|
| Size | 45.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7b50678cf22d974f96b5bf889e219ca8706c6aec3abf38f897f68e94cf81ff9d
|
|
BLAKE2b-256 checksum How to use checksums |
ea3cc6057c9c021160fd65beee23114e3832c4b16d818c71b7f7932e2a4c1c0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for o2switch-cli 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.