product:commands

List all CLI commands contributed by features in the active product.


Usage

splent product:commands

Example output

  Feature Commands

  Feature  Command               Flags            Description
  -------  --------------------  ---------------  ------------------------------
  mail     feature:mail config                     Show current SMTP configuration...
           feature:mail test     --to EMAIL *      Send a test email to verify SMTP...

  2 command(s) from 1 feature(s).

Description

Reads the app.extensions["splent_feature_commands"] registry populated by the framework during feature loading, and displays all feature-contributed CLI commands in a formatted table.

The table shows:

Column Description
Feature Short feature name (without splent_feature_ prefix).
Command Full invocation (e.g. feature:mail config).
Flags Options with their expected value type. Required flags are marked with *.
Description Short help text from the Click command.

How features contribute commands

Features define a commands.py module in their package with a cli_commands list:

# splent_feature_mail/commands.py
import click
from flask import current_app

@click.command("test")
@click.option("--to", required=True, metavar="EMAIL", help="Recipient address.")
def mail_test(to):
    """Send a test email to verify SMTP configuration."""
    svc = current_app.extensions["splent_mail_service"]
    svc.send_email(subject="Test", recipients=[to], body="Test email.")
    click.secho(f"  Sent to {to}.", fg="green")

@click.command("config")
def mail_config():
    """Show current SMTP configuration."""
    ...

cli_commands = [mail_test, mail_config]

The framework auto-discovers commands.py during feature loading and registers the commands. The CLI exposes them as subcommands under feature:<name>:

splent feature:mail test --to user@example.com
splent feature:mail config

Notes

  • Requires a running Flask app context (the product must be configured).
  • Commands are only available when the feature is declared and loaded in the active product.
  • The feature contract (feature:contract --write) auto-detects commands from commands.py.

See also

  • feature:contract – infer and update the feature contract (includes commands).

Back to top

splent. Distributed by an LGPL license v3. Contact us: drorganvidez@us.es