mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 18:15:28 +03:00
Update documentation and code snippets
This commit is contained in:
@@ -1,69 +0,0 @@
|
|||||||
# Argenta
|
|
||||||
|
|
||||||
### Bibliothek zum Erstellen modularer CLI-Anwendungen
|
|
||||||
|
|
||||||
Mit Argenta können Sie die CLI-Funktionalität in isolierte, abstrahierte Umgebungen einkapseln. Zum Beispiel: Sie erstellen ein Dienstprogramm ähnlich dem Metasploit Framework, bei dem der Benutzer zuerst in einen bestimmten Scoop eintritt (z. B. ein Modul zum Scannen auswählt) und dann auf eine Reihe von Befehlen zugreift, die nur für diesen Kontext spezifisch sind. Argenta bietet eine einfache und prägnante Möglichkeit, eine solche Architektur zu konstruieren.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
# Installation
|
|
||||||
```bash
|
|
||||||
pip install argenta
|
|
||||||
```
|
|
||||||
or
|
|
||||||
```bash
|
|
||||||
poetry add argenta
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
# Schnellstart
|
|
||||||
|
|
||||||
Ein Beispiel für eine einfache Anwendung
|
|
||||||
```python
|
|
||||||
# routers.py
|
|
||||||
from argenta.router import Router
|
|
||||||
from argenta.command import Command
|
|
||||||
from argenta.response import Response
|
|
||||||
|
|
||||||
|
|
||||||
router = Router()
|
|
||||||
|
|
||||||
@router.command(Command("hello"))
|
|
||||||
def handler(response: Response):
|
|
||||||
print("Hello, world!")
|
|
||||||
```
|
|
||||||
|
|
||||||
```python
|
|
||||||
# main.py
|
|
||||||
from argenta.app import App
|
|
||||||
from argenta.orchestrator import Orchestrator
|
|
||||||
from routers import router
|
|
||||||
|
|
||||||
app: App = App()
|
|
||||||
orchestrator: Orchestrator = Orchestrator()
|
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
|
||||||
app.include_router(router)
|
|
||||||
orchestrator.start_polling(app)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
# Funktionen in der Entwicklung
|
|
||||||
|
|
||||||
- Vollständige Unterstützung für Autocompleter unter Linux
|
|
||||||
|
|
||||||
## Vollständige [Dokumentation](https://argenta-docs.vercel.app) | MIT 2025 kolo | made by [kolo](https://t.me/kolo_id)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,45 +1,96 @@
|
|||||||
# Argenta
|
**Argenta** is a simple, yet elegant, CLI framework for building modular command-line applications. It provides a clean and intuitive way to create context-aware CLI tools with isolated command scopes.
|
||||||
|
|
||||||
### Library for creating modular CLI applications
|
Argenta is the **"Simplest"**, **"Most Modular"**, and **"Most Elegant"** way to build interactive CLI applications in Python. Production Ready!
|
||||||
|
|
||||||
#### RU - [README.ru.md](https://github.com/koloideal/Argenta/blob/main/README.ru.md) • DE - [README.de.md](https://github.com/koloideal/Argenta/blob/main/README.de.md)
|
📖 **Read the full documentation:** [argenta-docs.vercel.app](https://argenta-docs.vercel.app)<br>
|
||||||
|
🌍 **Other languages:** [RU](https://github.com/koloideal/Argenta/blob/main/README.ru.md)
|
||||||
---
|
|
||||||
|
|
||||||
Argenta allows you to encapsulate CLI functionality in isolated, abstracted environments. Eg: you are creating a utility similar to the Metasploit Framework, where the user first logs into a specific scope (for example, selects a module to scan), and then gets access to a set of commands specific only to that context. Argenta provides a simple and concise way to build such an architecture.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
---
|
```python
|
||||||
|
>>> from argenta import Router, Command, Response
|
||||||
# Installing
|
>>>
|
||||||
```bash
|
>>> router = Router()
|
||||||
pip install argenta
|
>>>
|
||||||
```
|
>>> @router.command(Command("hello"))
|
||||||
or
|
... def handler(response: Response):
|
||||||
```bash
|
... print("Hello, world!")
|
||||||
poetry add argenta
|
>>>
|
||||||
|
>>> from argenta import App, Orchestrator
|
||||||
|
>>>
|
||||||
|
>>> app = App()
|
||||||
|
>>> app.include_router(router)
|
||||||
|
>>> orchestrator = Orchestrator()
|
||||||
|
>>> orchestrator.start_polling(app)
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
Argenta allows you to build interactive CLI applications extremely easily. There's no need to manually parse complex command structures or manage state transitions — just use routers and commands!
|
||||||
|
|
||||||
# Quick start
|
## ✨ Installing Argenta and Supported Versions
|
||||||
|
|
||||||
|
Argenta is available on PyPI:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ python -m pip install argenta
|
||||||
|
```
|
||||||
|
|
||||||
|
or using Poetry:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ poetry add argenta
|
||||||
|
```
|
||||||
|
|
||||||
|
Argenta officially supports Python 3.7+.
|
||||||
|
|
||||||
|
## 🚀 Supported Features & Best Practices
|
||||||
|
|
||||||
|
Argenta is ready for the demands of building scalable, robust and maintainable CLI applications.
|
||||||
|
|
||||||
|
- Context-Aware Command Routing
|
||||||
|
- Isolated Command Scopes
|
||||||
|
- Modular Router Architecture
|
||||||
|
- Clean Decorator-Based API
|
||||||
|
- Response Object Pattern
|
||||||
|
- Command Orchestration
|
||||||
|
- Interactive Polling Mode
|
||||||
|
- Fully Type-Annotated
|
||||||
|
- Easy to Test
|
||||||
|
- Extensible
|
||||||
|
|
||||||
|
Need something more? Create an issue, we listen.
|
||||||
|
|
||||||
|
## 📝 Why did we create this?
|
||||||
|
|
||||||
|
Building complex CLI applications often requires managing different contexts and command scopes. For example, when creating a utility similar to the Metasploit Framework, users need to enter specific scopes (like selecting a scanning module) and then access commands specific only to that context.
|
||||||
|
|
||||||
|
Traditional CLI frameworks don't provide an elegant way to handle this kind of modular, context-aware architecture. Argenta was built to solve this problem by providing a simple and concise way to encapsulate CLI functionality in isolated, abstracted environments.
|
||||||
|
|
||||||
|
We believe that building CLI applications should be as pleasant as building web applications with modern frameworks. Argenta brings the router pattern and clean separation of concerns to the CLI world.
|
||||||
|
|
||||||
|
## 🚀 Quick Start
|
||||||
|
|
||||||
|
Here's a simple example to get you started:
|
||||||
|
|
||||||
An example of a simple application
|
|
||||||
```python
|
```python
|
||||||
# routers.py
|
# routers.py
|
||||||
from argenta.router import Router
|
from argenta.router import Router
|
||||||
from argenta.command import Command
|
from argenta.command import Command
|
||||||
from argenta.response import Response
|
from argenta.response import Response
|
||||||
|
|
||||||
|
|
||||||
router = Router()
|
router = Router()
|
||||||
|
|
||||||
@router.command(Command("hello"))
|
@router.command(Command("hello"))
|
||||||
def handler(response: Response):
|
def handler(response: Response):
|
||||||
|
"""A simple hello world command"""
|
||||||
print("Hello, world!")
|
print("Hello, world!")
|
||||||
|
|
||||||
|
@router.command(Command("greet"))
|
||||||
|
def greet_handler(response: Response):
|
||||||
|
"""Greet a user by name"""
|
||||||
|
name = response.args.get("name", "stranger")
|
||||||
|
print(f"Hello, {name}!")
|
||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
@@ -48,26 +99,36 @@ from argenta.app import App
|
|||||||
from argenta.orchestrator import Orchestrator
|
from argenta.orchestrator import Orchestrator
|
||||||
from routers import router
|
from routers import router
|
||||||
|
|
||||||
app: App = App()
|
app = App()
|
||||||
orchestrator: Orchestrator = Orchestrator()
|
orchestrator = Orchestrator()
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
|
# Include your routers
|
||||||
app.include_router(router)
|
app.include_router(router)
|
||||||
orchestrator.start_polling(app)
|
|
||||||
|
|
||||||
|
# Start the interactive CLI
|
||||||
|
orchestrator.start_polling(app)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
That's it! You now have a fully functional interactive CLI application with modular command routing.
|
||||||
|
|
||||||
|
## 🔮 Features in Development
|
||||||
|
|
||||||
|
- Full autocomplete support on Linux
|
||||||
|
- Enhanced context switching
|
||||||
|
- Built-in command history
|
||||||
|
- Plugin system for extensions
|
||||||
|
|
||||||
|
## 📚 Documentation
|
||||||
|
|
||||||
|
Full documentation is available at [argenta-docs.vercel.app](https://argenta-docs.vercel.app)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# Features in development
|
MIT 2025 kolo | made by [kolo](https://t.me/kolo_id)
|
||||||
|
|
||||||
- Full support for autocompleter on Linux
|
|
||||||
|
|
||||||
## Full [docs](https://argenta-docs.vercel.app) | MIT 2025 kolo | made by [kolo](https://t.me/kolo_id)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user