Skip to main content

Slash commands and autocompletions

Project description

Slashed

PyPI License Package status Daily downloads Weekly downloads Monthly downloads Distribution format Wheel availability Python version Implementation Releases Github Contributors Github Discussions Github Forks Github Issues Github Issues Github Watchers Github Stars Github Repository size Github last commit Github release date Github language count Github commits this week Github commits this month Github commits this year Package status Code style: black PyUp

Read the documentation!

A simple Python library for implementing slash commands with autocompletion support.

Features

  • Simple command registration system
  • Rich autocompletion support
  • Built-in file path and environment variable completion
  • Extensible completion provider system
  • Type-safe with full type hints
  • Modern Python features (3.12+)

Installation

pip install slashed

Quick Example

from slashed import Command, CommandStore, CommandContext
from slashed.output import DefaultOutputWriter

# Create a command store
store = CommandStore()

# Define a simple command
async def hello(ctx: CommandContext, args: list[str], kwargs: dict[str, str]) -> None:
    name = args[0] if args else "World"
    await ctx.output.print(f"Hello, {name}!")

hello_cmd = Command(
    name="hello",
    description="Say hello",
    execute_func=hello,
    usage="[name]"
)

# Register the command
store.register_command(hello_cmd)

# Create output writer
output = DefaultOutputWriter()

# Execute a command
await store.execute_command("hello Phil", CommandContext(output=output, data=None))

Documentation

For full documentation, visit slashed.readthedocs.io.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the 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

slashed-0.1.0.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

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

slashed-0.1.0-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: slashed-0.1.0.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.8

File hashes

Hashes for slashed-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d00cb5cf5357792b8fc9234af46bf36a213e54ec99b79855c9484ea4f74458f4
MD5 d83935972c8dfdc913c6f90a34b4236f
BLAKE2b-256 237984ac2b6195c6a39cc56f725864aca029dd0d2e95acc766b8b7c571d711b5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: slashed-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.8

File hashes

Hashes for slashed-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 935cff6e9dfe65d0f68d9df3801ff67453780646c8338bb2a1e28415bf83c836
MD5 31166fc1f7584c4bf32ee07e4d04fd54
BLAKE2b-256 5a0c26ac2f07626f5148db3ae01d4f27f1eea3ec9f6c5c38fbbac0ee91a1ce8c

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