ggen-cli-lib 26.7.3

CLI interface for ggen
Documentation
{#- Generated clap-noun-verb command module for {{ command_name }} -#}

use clap_noun_verb::Result;
use clap_noun_verb_macros::verb;
use serde_json::Value;

/// {{ command_name }} command.
///
/// clap-noun-verb derives the CLI surface from this function's signature:
/// required arguments become required `--flags`, `Option<T>` arguments become
/// optional flags, and `bool` parameters become switches. Add `#[arg(index = N)]`
/// to a parameter to make it positional instead.
#[verb]
pub fn {{ command_name | snake }}(
    {%- for argument in arguments %}
    {%- if argument.required %}
    {{ argument.name }}: {{ argument.type }},
    {%- else %}
    {{ argument.name }}: Option<{{ argument.type }}>,
    {%- endif %}
    {%- endfor %}
    {%- for flag in flags %}
    {{ flag.name }}: bool,
    {%- endfor %}
) -> Result<Value> {
    // Keep CLI parsing and business logic separate — delegate to the domain layer.
    crate::domain::{{ command_name | snake }}::execute(
        {%- for argument in arguments %}
        {{ argument.name }},
        {%- endfor %}
        {%- for flag in flags %}
        {{ flag.name }},
        {%- endfor %}
    )
}