moat-lib-run
% start main % start synopsis
Main command entry point infrastructure for MoaT applications.
% end synopsis
This module provides the infrastructure for building command-line interfaces for MoaT applications. It includes:
- Command-line argument parsing with Click integration
- Subcommand loading from internal modules and extensions
- Configuration file handling
- Logging setup
- Main entry point wrappers for testing
Usage
Basic command setup
from moat.lib.run import main_, wrap_main
@main_.command()
async def my_command(ctx):
"""A simple command"""
print("Hello from my command!")
Loading subcommands
Use load_subgroup to create command groups that automatically load subcommands:
from moat.lib.run import load_subgroup
import asyncclick as click
@load_subgroup(prefix="myapp.commands")
@click.pass_context
async def cli(ctx):
"""Main command group"""
pass
Processing command-line arguments
The attr_args decorator and process_args function provide flexible
argument handling:
from moat.lib.run import attr_args, process_args
@main_.command()
@attr_args(with_path=True)
async def configure(**kw):
"""Configure the application"""
config = process_args({}, **kw)
# config now contains parsed arguments
Key Functions
main_: The default main command handlerwrap_main: Wrapper for the main command, useful for testingload_subgroup: Decorator to create command groups with automatic subcommand loadingattr_args: Decorator for adding flexible argument handling to commandsprocess_args: Function to process command-line arguments into configurationLoader: Click group class that loads commands from submodules and extensions
% end main
Metadata
Release files for moat-lib-run 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| moat_lib_run-0.2.2.tar.gz | 14.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| moat_lib_run-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.0 kB
Release files / moat_lib_run-0.2.2.tar.gz
| Download URL | moat_lib_run-0.2.2.tar.gz |
|---|---|
| Size | 14.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c3ba19c8a840076711a9866ad15df1bc463c58cf5c73dd6868c12196e730b37f
|
|
BLAKE2b-256 checksum How to use checksums |
de41f365744e2b6fcca4675dd7b58bc1771e5d6d956dc49e65c93b82f9caa303
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / moat_lib_run-0.2.2-py3-none-any.whl
| Download URL | moat_lib_run-0.2.2-py3-none-any.whl |
|---|---|
| Size | 11.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
33e62e86eaf0347755192c1e581ca819a8f60c37e706ebc1d1e773f16ceeaf08
|
|
BLAKE2b-256 checksum How to use checksums |
c56f19a988015f881627342db7bcd5789df7b4eda055a6c33501a2f546634caa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|