A parser for dot-separated commands with argument handling and error correction.
Project description
DotCommandParser
DotCommandParser is a Python module for parsing and executing dot-separated commands with arguments. It provides support for error correction by suggesting probable commands based on previous inputs.
Installation
You can install the module via pip:
Usage Example
from dotcommandparser import DotCommandParser
# Initialize the parser with some commands
parser = DotCommandParser()
# Execute a command
parser.execute_command("commands.test")
# Show available commands
parser.execute_command("commands.show")
# Execute a non-existent command (Error handling example)
parser.execute_command("unknown_command")
# Example Functions
def set_color(color):
print(f">> Background color set to {color}")
def set_colors(foreground, background):
print(f">> Foreground: {foreground}, Background: {background}")
# Make a dictionary
COMMANDS = {
"chat": {
"font": {
"color": set_color,
},
"icon": {
"color": set_colors,
},
},
}
parser2 = DotCommandParser(COMMANDS)
parser2.execute_command("chat.icon.color.white,black")
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 dot_cmd_parser-0.1.0.tar.gz.
File metadata
- Download URL: dot_cmd_parser-0.1.0.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02b95d7eb36c2b6646559d39e56dc336ea07aa5ec7203f63441dbec13f933b8d
|
|
| MD5 |
bf483ff1db9e52345820e4543e483486
|
|
| BLAKE2b-256 |
e7ebcffd92448408cf1da49c48e8471da6ecf8d4aa5d0ca9c41d28f76e1d6409
|
File details
Details for the file dot_cmd_parser-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dot_cmd_parser-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46494032331b1b17120eae1f27af6b51d1a0311715811950745d37d91524169d
|
|
| MD5 |
c4a2b47eb3c897d0f2147f58b894d06b
|
|
| BLAKE2b-256 |
4105dc4f2628125ca2cd6100827d488f139c857dece6a6a72048efd74093cd7f
|