Skip to main content

Command-line tools for Sphinx documentation management

Project description

Sphinx-CMD

A collection of command-line tools for managing Sphinx documentation.

Installation

pip install sphinx-cmd

Commands

The sphinx-cmd tool provides subcommands for different Sphinx documentation management tasks.

sphinx-cmd rm

Delete unused .rst files and their unique assets (images, includes, etc) if not used elsewhere.

# Remove files and assets
sphinx-cmd rm path/to/docs

# Dry run to preview deletions
sphinx-cmd rm path/to/docs --dry-run

sphinx-cmd mv

Move/rename .rst files and automatically update all references to them.

# Move and update all references
sphinx-cmd mv old-file.rst new-file.rst

# Move to a different directory
sphinx-cmd mv chapter1.rst topics/chapter1.rst

# Preview the move without making changes
sphinx-cmd mv old-file.rst new-file.rst --dry-run

# Move without updating references
sphinx-cmd mv old-file.rst new-file.rst --no-update-refs

Features

  • Automatically updates toctree entries
  • Updates :doc: references
  • Updates include and literalinclude directives
  • Handles relative paths correctly
  • Preserves file relationships

Development

# Clone the repository
git clone https://github.com/yourusername/sphinx-cmd.git
cd sphinx-cmd

# Install in development mode with dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run linters
black sphinx_cmd tests
flake8 sphinx_cmd tests
mypy sphinx_cmd

# Test the command
sphinx-cmd --help
sphinx-cmd rm --help
sphinx-cmd mv --help

Adding New Commands

The architecture is designed to make adding new commands easy:

  1. Create a new file in sphinx_cmd/commands/ (e.g., new_command.py)
  2. Implement an execute(args) function in your new file
  3. Import the command in sphinx_cmd/cli.py
  4. Add a new subparser for your command in create_parser()

License

MIT License - see LICENSE file for details.

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

sphinx_cmd-0.2.2.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

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

sphinx_cmd-0.2.2-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file sphinx_cmd-0.2.2.tar.gz.

File metadata

  • Download URL: sphinx_cmd-0.2.2.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for sphinx_cmd-0.2.2.tar.gz
Algorithm Hash digest
SHA256 f621446a8272a631d2d9d1c4481a57cdd52c9555f613fcc1b25781898ebf08f1
MD5 cde4792f8ca1957a5a3943cd0ebfbb15
BLAKE2b-256 0ac85f8998a4e548200aed18ce954e67b09c642bd99c0dc74119297139d87659

See more details on using hashes here.

File details

Details for the file sphinx_cmd-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: sphinx_cmd-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for sphinx_cmd-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a2fda7a9f1acd5a060677115e24f9ee4f885b04091599268ea63295012c53ba5
MD5 4b7d2b5726a63f22006f598f950879c6
BLAKE2b-256 223ba876d869973057a7ad0237c0994a5ec227f4fecbc562e8b021371a5c53a9

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