ores.cpp.shell-command.command_aggregator_implementation

Table of Contents

The bodies behind the declarations of the sibling ores.cpp.shell-command.command_aggregator_header archetype: the unit includes and one register_commands call per unit.

The list arrives as shell_aggregator.units, injected by the generator at render time from the component's opted-in entity models and the local units its shell overview declares. Each entry names one unit – its header stem and its class name. Every unit reads the root menu and the session, because the generated list verb spells paging as flags. The generator sorts the entries by unit name, so the calls are stable from one render to the next and a new unit lands in its alphabetical place rather than at the end.

See the Template variable reference for the complete list of available variables and their semantics.

1. Template

The full template source. Edit here and re-tangle with compass build --direct tangle_codegen_templates to regenerate library/templates/cpp_shell_command_aggregator_impl.cpp.mustache.

{{! GENERATED FILE — tangled from projects/ores.codegen/library/templates/ores.cpp.shell-command.command_aggregator_implementation.org. Edit the org source. }}
{{{cpp_license}}}
{{#shell_aggregator}}
#include "ores.shell/app/commands/{{component}}/{{component}}_commands.hpp"
{{#units}}
#include "ores.shell/app/commands/{{component}}/{{unit}}.hpp"
{{/units}}

namespace ores::shell::app::commands {

using namespace logging;

void {{component}}_commands::register_commands(cli::Menu& root_menu,
                                               ores::nats::service::nats_client& session) {
    BOOST_LOG_SEV(lg(), debug) << "Registering {{component}} command surface.";
{{#units}}
    {{unit}}::register_commands(root_menu, session);
{{/units}}
}

}
{{/shell_aggregator}}

2. See also

Emacs 29.3 (Org mode 9.6.15)