feat: implement --emoji flag and MARKITECT_EMOJI environment variable - Issue #37
Add comprehensive emoji preference support to complement existing --ascii flag: 🎯 Core Features: • Add --emoji flag to visualization tools (visualize_schema.py, schema_summary.py) • Implement MARKITECT_EMOJI environment variable support • Maintain backward compatibility with existing --ascii flag behavior • Establish proper priority: CLI flags > environment variables > defaults 🏗️ Architecture: • Create shared emoji_utils.py module for centralized logic • Implement determine_output_mode() for standardized preference resolution • Add add_emoji_arguments() for consistent argument parser setup • Follow DRY principle - eliminate duplicate code between tools 🧪 Testing: • 18 comprehensive tests covering all functionality • Basic flag tests: existence, mutual exclusivity, defaults, precedence • Environment variable tests: recognition, case handling, CLI overrides • Configuration integration tests: system compatibility, error handling • All 1337 project tests pass (no regressions) 💡 User Experience: • Consistent behavior across all MarkiTect visualization tools • Multiple preference setting methods (CLI flags, environment variables) • Robust error handling with sensible defaults (emoji by default) • Clear help documentation and discoverable usage patterns 🔧 Implementation Details: • Mutually exclusive argument groups prevent conflicting flags • Case-insensitive environment variable processing • Valid false values: 'false', 'f', '0' - all others default to emoji • Comprehensive documentation with usage examples The implementation follows TDD principles and MarkiTect architectural patterns, ensuring high quality and maintainability while delivering enhanced usability features. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -6,12 +6,15 @@ Beautiful command-line visualization for markdown schema structure.
|
||||
import sys
|
||||
import json
|
||||
import argparse
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
# Add markitect to path
|
||||
sys.path.insert(0, '.')
|
||||
|
||||
from markitect.schema_generator import SchemaGenerator
|
||||
# Issue #37: Import shared emoji/ASCII output mode utilities
|
||||
from emoji_utils import determine_output_mode, add_emoji_arguments
|
||||
|
||||
def visualize_schema_structure(file_path, max_depth=None, ascii_only=False):
|
||||
"""Create a beautiful tree visualization of the document structure."""
|
||||
@@ -177,7 +180,9 @@ def main():
|
||||
parser = argparse.ArgumentParser(description='Visualize markdown document schema structure')
|
||||
parser.add_argument('file_path', help='Path to the markdown file')
|
||||
parser.add_argument('--max-depth', type=int, help='Maximum heading depth to include')
|
||||
parser.add_argument('--ascii', action='store_true', help='Use ASCII characters only (no colorful icons)')
|
||||
|
||||
# Issue #37: Add emoji/ASCII output format arguments
|
||||
add_emoji_arguments(parser)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
@@ -185,7 +190,11 @@ def main():
|
||||
print(f"File not found: {args.file_path}")
|
||||
sys.exit(1)
|
||||
|
||||
visualize_schema_structure(args.file_path, args.max_depth, args.ascii)
|
||||
# Issue #37: Determine output mode using shared utility
|
||||
# Respects CLI flags and MARKITECT_EMOJI environment variable
|
||||
use_ascii = determine_output_mode(args)
|
||||
|
||||
visualize_schema_structure(args.file_path, args.max_depth, use_ascii)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user