NAME

WWW::Bund::CLI - CLI client for German Federal Government APIs

VERSION

version 0.001

SYNOPSIS

# Command line usage
bund                            # Overview
bund list                       # List all APIs
bund info autobahn              # Show API details
bund autobahn roads             # Execute API call
bund autobahn webcams A7        # With parameters
bund pegel stations --output json
bund nina warnings 091620000000 --lang en

# Library usage
use WWW::Bund::CLI;

my $cli = WWW::Bund::CLI->new_with_cmd(
    output => 'json',
    lang   => 'de',
);

DESCRIPTION

Root CLI application using MooX::Cmd for command dispatch. Provides global options (--output, --lang, --template) and discovery commands (list, info).

API-specific commands are implemented as subcommands in WWW::Bund::CLI::Cmd::* modules. Most use WWW::Bund::CLI::Role::APICommand for uniform dispatch.

Global Options

  • --output, -o - Output format: template (default), json, yaml

  • --lang - Language (de, en, fr, es, it, nl, pl). Defaults to $ENV{WWW_BUND_LANG} or 'de'

  • --template, -t - Override template file path

Commands

Multi-language Support

The CLI is available in 7 language-specific wrappers:

  • bund - German (default)

  • bunden - English

  • bundfr - French

  • bundes - Spanish

  • bundit - Italian

  • bundnl - Dutch

  • bundpl - Polish

Each wrapper sets WWW_BUND_LANG to pre-select the language.

output

Output format: template (default), json, or yaml.

Template mode uses YAML templates from share/templates/{lang}/ to format output as tables, lists, or records.

lang

Language for CLI strings and templates. Supported: de, en, fr, es, it, nl, pl.

Defaults to $ENV{WWW_BUND_LANG} or de.

template

Override template file path for output formatting. Useful for custom templates.

strings

WWW::Bund::CLI::Strings instance for localized CLI messages.

formatter

WWW::Bund::CLI::Formatter instance for template-based output formatting.

bund

WWW::Bund client instance for making API calls.

execute

Default command when no subcommand is given. Shows overview or error if unknown API is specified.

cmd_overview

Display categorized overview of all APIs: available (public with endpoints), needs auth, and not yet implemented (split by public vs auth-required).

cmd_list

List all APIs in table format (or JSON/YAML if requested). Shows ID, title, auth type, and tags.

cmd_info

$cli->cmd_info($api_id);

Show detailed information about an API: provider, auth, docs, rate limit, and list of available endpoints with parameters.

cmd_api_help

$cli->cmd_api_help($api_id);

Show help for a specific API: available actions (endpoints) with parameter signatures and usage example.

Called when an API command is invoked without action (e.g., bund autobahn).

cmd_call

my $rc = $cli->cmd_call($api_id, $action, @args);

Execute an API call with argument parsing. Returns exit code (0 on success, 1 on error).

Arguments can be positional or named:

  • Positional args are mapped to path parameters first, then query parameters

  • --key=value or --key value for explicit parameter assignment

Output is formatted according to --output option.

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.