refactor(output_format): support print key value list style for text format#63
Merged
aviatco merged 15 commits intomicrosoft:mainfrom Nov 13, 2025
Merged
Conversation
ayeshurun
reviewed
Nov 10, 2025
ayeshurun
reviewed
Nov 10, 2025
ayeshurun
reviewed
Nov 10, 2025
ayeshurun
reviewed
Nov 10, 2025
added 2 commits
November 10, 2025 13:36
ayeshurun
reviewed
Nov 11, 2025
Collaborator
|
please add changie entry |
ayeshurun
previously approved these changes
Nov 11, 2025
ohadedry
reviewed
Nov 11, 2025
ohadedry
reviewed
Nov 11, 2025
added 2 commits
November 12, 2025 08:12
…com/aviatco/fabric-cli into dev/aviatcohen/supportPrintKeyValue
ayeshurun
previously approved these changes
Nov 12, 2025
ohadedry
reviewed
Nov 12, 2025
ohadedry
previously approved these changes
Nov 12, 2025
ohadedry
previously approved these changes
Nov 13, 2025
ohadedry
approved these changes
Nov 13, 2025
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📥 Pull Request
✨ Description of new changes
Overview
This PR introduces a new output formatting option that displays data in a clean, human-readable key-value format instead of the default JSON structure. This enhancement improves the user experience by providing a more intuitive way to view command outputs.
Key Changes
FabricCLIOutput: Added show_key_value_pretty parameter to control the new formatting option
print_output_format(): Enhanced the main output function to support the new formatting parameter
_print_entries_key_value_pretty_style(): Implemented the core function that converts data into key-value format
_format_key_to_pretty_name(): Added utility to transform snake_case and camelCase keys into readable "Title Case" format
Text Output Handler: Updated _print_output_format_result_text() to conditionally use key-value formatting when show_key_value_pretty=True
Format Priority: JSON format takes precedence over key-value formatting to maintain backward compatibility
Unit Tests: Added extensive test coverage including:
Key-value pretty format activation and output verification
JSON format precedence testing
Input validation and error handling
Key formatting transformation tests
Features
Output Format Examples
Before (JSON):
{
"logged_in": "true",
"account_name": "johndoe@example.com"
}
After (Key-Value Pretty):
Logged In: true
Account Name: johndoe@example.com
Key Formatting Intelligence
Converts snake_case → Title Case (e.g., logged_in → Logged In)
Converts camelCase → Spaced Title Case (e.g., accountName → Account Name)
Handles both single dictionaries and lists of dictionaries
Adds spacing between multiple entries for clarity
Integration Points
Works with existing print_output_format() calls throughout the codebase
Maintains full backward compatibility
Respects output format precedence (JSON > key-value > default)
Technical Implementation
Type Safety: Proper input validation with meaningful error messages
Performance: Minimal overhead, only processes data when explicitly enabled
Extensibility: Clean separation of concerns allows easy future enhancements
Error Handling: Graceful fallback for invalid input types
Testing
✅ Unit tests for all new functions and edge cases
✅ Integration tests with existing output pipeline
✅ Error handling and input validation coverage
✅ Format precedence verification
This enhancement provides users with a more readable alternative to JSON output while maintaining full compatibility with existing workflows and scripts.
## NOTE The flag only affects text output mode; JSON output ignores this setting.