Skip to content

Latest commit

 

History

History
58 lines (36 loc) · 1.41 KB

File metadata and controls

58 lines (36 loc) · 1.41 KB

CLI Flow

Sources: bin/useragent, src/Console/ConsoleApp.php

Trigger

Run the CLI executable:

./bin/useragent [options]

Input

CLI args parsed as --key=value (or --flag => true).

Validation

  • Browser/device/os values are parsed with enum tryFrom in buildSpec().
  • Invalid bot type fails in generateBot() and returns non-zero exit code.
  • Count is clamped to 1..100 in standard generation path.

Transformation

  1. Route command path: help, examples, bot, or standard generation.
  2. Standard path builds optional GenerationSpec from parsed arguments.
  3. Loop for count; call UserAgentService::generate($spec) each iteration.
  4. If --unique is set, command retries generation up to 50 attempts for per-run uniqueness.
  5. Render output as text, json, or csv.

Persistence

None.

Side Effects

Writes output to stdout; errors to stderr.

Output

  • Exit code 0 on success.
  • Exit code 1 on exceptions or invalid bot type.

Failure Cases

  • Service exceptions propagate to top-level catch and return 1.
  • Unknown bot type returns 1 with available bot list.
  • Invalid enum inputs are ignored rather than rejected; resulting spec may become unconstrained.

Next

Related