A modular and extensible command-line engine for building structured CLI tools with zero boilerplate.
- Plug-and-play command architecture
- Autoload commands from your
tools/directory - Support for custom command types defined per project
- Minimal setup required per project
- Easy to test, extend, and maintain
Make sure Python 3.8+ and pip are installed:
python3 --version
pip --versiongit clone https://github.com/wesleybertipaglia/cliengine.git
cd clienginepip install -e .This allows you to make changes to the engine while immediately reflecting them in any project using it.
A simple example usage was provided in the
example/directory.
Create a file (e.g., command_types.py) in your project root to declare your command types:
from enum import Enum, auto
class CommandType(Enum):
FILE = auto()
FOLDER = auto()
ARCHIVE = auto()You can define as many types as needed, using auto() for automatic enumeration values.
Create your commands in the tools/ folder (or wherever you prefer), importing your own CommandType enum:
from cliengine.command import Command
from command_type import CommandType
class FileCompressorCommand(Command):
def name(self):
return "File Compressor"
def type(self):
return CommandType.FILE
def run(self):
print("Running File Compressor...")In your main.py, load commands and pass your CommandType list to the runner:
from cliengine.loader import load_commands_from
from cliengine.runner import run_cli
from command_type import CommandType
load_commands_from("tools")
run_cli(
app_name="My CLI Tool",
description="A powerful command-line utility.",
types=list(CommandType)
)python main.pyContributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
This project is licensed under the MIT License - see the LICENSE file for details.