Typer CLI integration

The eyconf.cli module provides a convenient way to create a command-line interface (CLI) for managing configuration files using the typer library. This can be particularly useful when you want to provide users with the ability to interact and modify configuration files via the terminal.

You need to install the cli additions to use this feature. You can install it using pip:

pip install eyconf[cli]

Integrating the CLI into Your Project

To integrate the CLI into your project, follow these steps:

from eyconf.cli import create_config_cli
from eyconf import EYConf
from your_project.config import ConfigSchema  # Adjust the import to your actual config schema
from your_project import app  # Adjust the import to your actual Typer app

# Your main typer app
app = typer.Typer()
sub_app = create_config_cli(EYConf, schema)
app.add_typer(sub_app, name="config")

The CLI Commands

The CLI provides several commands to manage your configuration:

 config Usage: config [OPTIONS] COMMAND [ARGS]... Manage configuration file ╭─ Options ────────────────────────────────────────────────────────────────────╮ --edit-eEdit the configuration. --helpShow this message and exit. ╰──────────────────────────────────────────────────────────────────────────────╯ ╭─ Commands ───────────────────────────────────────────────────────────────────╮ ls Show the current configuration.                                         ╰──────────────────────────────────────────────────────────────────────────────╯
 config Usage: config [OPTIONS] COMMAND [ARGS]... Manage configuration file ╭─ Options ────────────────────────────────────────────────────────────────────╮ --edit-eEdit the configuration. --helpShow this message and exit. ╰──────────────────────────────────────────────────────────────────────────────╯ ╭─ Commands ───────────────────────────────────────────────────────────────────╮ ls Show the current configuration.                                         ╰──────────────────────────────────────────────────────────────────────────────╯