Skip to content

Conversation

cidrblock
Copy link
Contributor

@cidrblock cidrblock commented Jul 25, 2025

Summary

Updates the markup system to align with Ansible color conventions and improves consistency across formatting methods.

Changes

Color Scheme Enhancement:

  • Updated markup_map with Ansible-consistent ANSI codes
  • info: cyan+dim (matches Ansible skip messages)
  • warning: magenta+bold (matches Ansible warn messages)
  • action: yellow (matches Ansible changed messages)
  • scenario: green (matches Ansible OK messages)

API Improvements:

  • format_log_level(): Removed level_no parameter, now uses process_markup() with logging.level.* tags
  • format_scenario(): Added optional step parameter with RIGHT_ARROW symbol for enhanced display
  • Both methods now use process_markup() for consistent tag processing

Backward Compatibility

All changes maintain full backward compatibility. Existing method signatures work unchanged, with new optional parameters providing enhanced functionality.

Testing

  • 41/41 ansi_output unit tests pass
  • Added test coverage for new step parameter functionality
  • All pre-commit checks pass (ruff, pylint, mypy, etc.)

Technical Details

Three focused commits implement these changes incrementally, each maintaining test coverage and code quality standards.

- Update markup_map with Ansible-consistent color mappings
- info: cyan+dim (matches Ansible skip)
- warning: magenta+bold (matches Ansible warn)
- action: yellow (matches Ansible changed)
- scenario: green (matches Ansible OK)
- Add comprehensive documentation explaining color alignment strategy
- Maintain full backward compatibility with existing markup tags
- Remove level_no parameter, simplify to only use level_name
- Use process_markup() with logging.level.* tags for consistency
- Update tests to match new signature and Ansible-aligned colors:
  - DEBUG: dim (gray)
  - INFO: cyan (matches Ansible skip)
  - WARNING: magenta (matches Ansible warn)
  - ERROR: red (matches Ansible error)
- All 40 ansi_output tests pass, full backward compatibility maintained
- Add optional step parameter for enhanced scenario formatting
- Use process_markup() with [scenario] and [action] tags for consistency
- Add RIGHT_ARROW (➜) symbol constant for step separation
- Format: '[scenario_name] ➜ [step]:' with colors when step provided
- Add comprehensive test for step functionality
- All 41 ansi_output tests pass, full backward compatibility maintained
@cidrblock cidrblock requested a review from a team as a code owner July 25, 2025 21:17
@cidrblock cidrblock changed the title Enhance Rich-style markup color scheme and formatting methods Enhance color scheme and formatting methods Jul 25, 2025
@cidrblock cidrblock merged commit 1b06311 into ansible:main Jul 25, 2025
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants