Slash commands and autocompletions
Project description
Slashed
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d00cb5cf5357792b8fc9234af46bf36a213e54ec99b79855c9484ea4f74458f4
|
|
| MD5 |
d83935972c8dfdc913c6f90a34b4236f
|
|
| BLAKE2b-256 |
237984ac2b6195c6a39cc56f725864aca029dd0d2e95acc766b8b7c571d711b5
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
935cff6e9dfe65d0f68d9df3801ff67453780646c8338bb2a1e28415bf83c836
|
|
| MD5 |
31166fc1f7584c4bf32ee07e4d04fd54
|
|
| BLAKE2b-256 |
5a0c26ac2f07626f5148db3ae01d4f27f1eea3ec9f6c5c38fbbac0ee91a1ce8c
|