CLI
CLI Main Module¶
main ¶
Main CLI entry point for AVD CLI.
This module defines the main CLI group and command structure using Click.
cli ¶
AVD CLI - Process Arista AVD inventories and generate configurations.
This tool processes Arista Ansible AVD inventories using py-avd to generate: - Device configurations - Documentation - ANTA tests
Examples:
Generate all outputs (configs, docs, tests):
$ avd-cli generate all -i ./inventory -o ./output
Generate only configurations:
$ avd-cli generate configs -i ./inventory -o ./output
Generate for specific groups:
$ avd-cli generate all -i ./inventory -o ./output -l spine -l leaf
Display inventory information:
$ avd-cli info -i ./inventory
For more information on each command or command group:
$ avd-cli COMMAND --help
$ avd-cli generate --help
Source code in avd_cli/cli/main.py
common_generate_options ¶
Apply common options to all generate subcommands.
All options support environment variables with the prefix AVD_CLI_. Environment variables are automatically shown in –help output. Command-line arguments take precedence over environment variables.
Source code in avd_cli/cli/main.py
display_generation_summary ¶
display_generation_summary(
category: str,
count: int,
output_path: Path,
subcategory: str = "configs",
) -> None
Display a summary table for generated files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
category
|
str
|
Category of generated files (e.g., “Configurations”, “Documentation”) |
required |
count
|
int
|
Number of files generated |
required |
subcategory
|
str
|
Subdirectory name under output_path, by default “configs” |
'configs'
|
Source code in avd_cli/cli/main.py
info ¶
Display inventory information and statistics.
This command analyzes the inventory and displays information about devices, groups, and fabric structure.
All options can be provided via environment variables with AVD_CLI_ prefix. Command-line arguments take precedence over environment variables.
Examples:
Display inventory info as table:
$ avd-cli info -i ./inventory
Display inventory info as JSON:
$ avd-cli info -i ./inventory --format json
Using environment variables:
$ export AVD_CLI_INVENTORY_PATH=./inventory
$ export AVD_CLI_FORMAT=json
$ avd-cli info
Source code in avd_cli/cli/main.py
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 | |
main ¶
Main entry point for the CLI application.
Source code in avd_cli/cli/main.py
resolve_output_path ¶
Resolve the output path, applying default if needed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inventory_path
|
Path
|
Path to the inventory directory |
required |
output_path
|
Optional[Path]
|
User-provided output path, or None to use default |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Resolved output path (defaults to |
Source code in avd_cli/cli/main.py
suppress_pyavd_warnings ¶
Suppress pyavd deprecation warnings unless explicitly requested.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
show_warnings
|
bool
|
If False, suppress deprecation warnings from pyavd |
required |
Source code in avd_cli/cli/main.py
validate ¶
Validate AVD inventory structure and data.
This command validates the inventory structure, YAML syntax, and data integrity without generating any output files.
All options can be provided via environment variables with AVD_CLI_ prefix. Command-line arguments take precedence over environment variables.
Examples:
Validate inventory structure:
$ avd-cli validate -i ./inventory
Using environment variables:
$ export AVD_CLI_INVENTORY_PATH=./inventory
$ avd-cli validate
Source code in avd_cli/cli/main.py
version_callback ¶
Display version information for avd-cli and pyavd.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
Context
|
The Click context. |
required |
param
|
Parameter
|
The Click parameter. |
required |
value
|
bool
|
Whether the option was provided. |
required |