-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Summary
Implement enhanced PowerShell prompt customization inspired by Scott Hanselman's blog post "My Ultimate PowerShell prompt with Oh My Posh and the Windows Terminal" to provide a rich, informative, and visually appealing command-line experience in our PowerShell container.
Blog Post Key Features Analysis
The blog post demonstrates several powerful prompt customization features:
🎨 Oh My Posh Integration
- Cross-platform prompt theme engine with JSON-based configuration
- Extensive segment library (git, battery, Azure, dotnet versions, etc.)
- Powerline-style visual elements with custom glyphs
- Performance-optimized with configurable segments
🔤 Enhanced Typography
- Nerd Fonts support (specifically CaskaydiaCove NF)
- Unicode glyphs and icons for visual enhancement
- Proper font fallback handling
📁 Terminal-Icons Module
- Colorized directory listings with file-type icons
- Enhanced
ls/dircommand output - Visual file type identification
⌨️ PSReadLine Enhancements
- Predictive autocomplete functionality
- Custom key bindings (e.g., Ctrl+Shift+B for
dotnet build) - Improved command-line editing experience
🔧 Git Integration
- Branch status display
- Stash count indicators
- Upstream tracking information
- Working directory status (modified, untracked files)
Proposed Implementation for Container Environment
🐳 Container-Specific Adaptations
-
Oh My Posh Installation
- Install Oh My Posh binary during container build
- Create container-optimized theme configuration
- Focus on segments relevant to containerized development
-
PowerShell Profile Setup
- Create default PowerShell profile (
$PROFILE) forcoderuser - Initialize Oh My Posh with custom theme
- Configure Terminal-Icons and PSReadLine modules
- Create default PowerShell profile (
-
Font Considerations
- Document Nerd Font requirements for host terminals
- Provide fallback configuration for environments without Nerd Fonts
- Include font installation guidance in documentation
-
Container-Relevant Segments
- Git status (essential for development containers)
- Current directory path with truncation
- Execution time for long-running commands
- Exit code indicators
- Optional: Container/environment indicators
📋 Technical Implementation Details
Dockerfile Changes
# Install Oh My Posh
RUN curl -s https://ohmyposh.dev/install.sh | bash -s
# Install PowerShell modules
RUN pwsh -c "Install-Module -Name Terminal-Icons -Force -Scope AllUsers"
RUN pwsh -c "Install-Module -Name PSReadLine -Force -Scope AllUsers"
# Copy PowerShell profile and Oh My Posh theme
COPY config/Microsoft.PowerShell_profile.ps1 /home/coder/.config/powershell/
COPY config/container-theme.omp.json /home/coder/.config/ohmyposh/PowerShell Profile Structure
- Oh My Posh initialization
- Terminal-Icons import
- PSReadLine configuration
- Custom aliases and functions
- Container-specific optimizations
Oh My Posh Theme
- Minimal, performance-focused segments
- Git integration with essential status info
- Path display with smart truncation
- Execution time and exit code indicators
- Fallback glyphs for non-Nerd Font environments
🎯 Acceptance Criteria
✅ Core Functionality
- Oh My Posh successfully initializes in container
- Custom theme displays correctly with and without Nerd Fonts
- Git status information appears when in git repositories
- Terminal-Icons enhances directory listings
- PSReadLine provides improved command-line editing
✅ Performance Requirements
- Prompt initialization adds <500ms to container startup
- Prompt rendering is responsive (<100ms for typical operations)
- No significant impact on container image size (<50MB increase)
✅ Compatibility
- Works with standard terminal emulators (no Nerd Font requirement)
- Graceful degradation when advanced features unavailable
- Maintains compatibility with existing container usage patterns
✅ Documentation
- Updated README with prompt customization information
- Font installation guidance for optimal experience
- Customization instructions for users
- Performance impact documentation
✅ Testing
- Unit tests for PowerShell profile components
- Integration tests for Oh My Posh functionality
- Visual regression tests for prompt appearance
- Performance benchmarks for startup and rendering
🔄 Implementation Phases
Phase 1: Basic Oh My Posh Integration
- Install Oh My Posh in container
- Create minimal theme with essential segments
- Basic PowerShell profile setup
Phase 2: Enhanced Features
- Terminal-Icons integration
- PSReadLine configuration
- Git status enhancements
Phase 3: Optimization & Polish
- Performance tuning
- Advanced customization options
- Comprehensive documentation
🚀 Benefits
-
Enhanced Developer Experience
- Rich visual feedback for git operations
- Improved command-line productivity
- Professional, modern terminal appearance
-
Container Differentiation
- Unique value proposition for PowerShell container
- Demonstrates advanced PowerShell capabilities
- Attracts developers seeking enhanced tooling
-
Educational Value
- Showcases PowerShell customization best practices
- Demonstrates cross-platform PowerShell features
- Provides template for user customizations
🔗 References
Priority: Medium-High
Complexity: Medium
Estimated Effort: 2-3 development cycles
Dependencies: None (additive feature)