NAME

WWW::Bund::CLI::Role::APICommand - Shared role for API command dispatch

VERSION

version 0.001

SYNOPSIS

package WWW::Bund::CLI::Cmd::MyAPI;
use Moo;
use MooX::Cmd;
use MooX::Options protect_argv => 0;

with 'WWW::Bund::CLI::Role::APICommand';

sub api_id { 'my_api' }

1;

DESCRIPTION

Shared role for API-specific CLI command classes. Provides generic execute method that dispatches to the root CLI's cmd_call or cmd_api_help.

Consuming classes only need to implement api_id method to return the API identifier. This keeps API command classes minimal (typically 10 lines).

Execution Flow

1. If no args: show API help via cmd_api_help
2. Otherwise: extract action from first arg, call cmd_call
3. Exit with return code if call fails

REQUIRED METHODS

api_id

sub api_id { 'autobahn' }

Return the API identifier string used for endpoint lookup.

execute

Generic command execution. Handles both help display and API call dispatch.

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-www-bund/issues.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.