Fix .NET version script and enhance Oh My Posh integration#7
Merged
Conversation
- Add Oh My Posh installation to Dockerfile - Install Nerd Fonts (CaskaydiaCove) for enhanced glyphs - Create custom PowerShell profile with Oh My Posh initialization - Add container-optimized Oh My Posh theme configuration - Include Terminal-Icons and PSReadLine module installation - Add comprehensive documentation for enhanced prompt features - Create test scripts for validation - Update README with enhanced prompt feature overview Addresses feature request #4 for Scott Hanselman-inspired prompt customization
This commit addresses multiple issues:
1. Script Fix (get-net-pwsh-versions.sh):
- Fixed jq queries to handle multiple active LTS .NET releases
- Added first() to select only the newest LTS release
- Resolves Docker build failures when both .NET 10.0 and 8.0 are active LTS
2. Oh My Posh Enhancements:
- Embedded Blue PSL 10K theme in container (works offline)
- Added runtime environment variables:
* ENABLE_OHMYPOSH (default: true) - disable Oh My Posh at runtime
* OHMYPOSH_THEME - select built-in or custom themes
- Implemented three-tier fallback: custom → Blue PSL 10K → basic prompt
- Theme selection supports URLs, built-in names, and file paths
3. Container Optimization:
- Removed unused Nerd Font installation (~150MB savings)
- Fonts must be installed on HOST machine, not in container
- Fixed useradd shell from /bin/zsh to /bin/bash
4. Documentation:
- Added comprehensive host font configuration instructions
- Documented environment variables with usage examples
- Added theme fallback behavior explanation
- Added GitHub Sponsors badge
Fixes #3
Fixes #4
aed99aa to
c8836a0
Compare
Removed tests for Nerd Font installation since fonts must be installed on the HOST machine, not in the container. Added tests for the new ENABLE_OHMYPOSH and OHMYPOSH_THEME environment variables instead.
Changes: - Consolidated ci.yml and test.yml into single CI/CD Pipeline - PRs: Build test image locally (no push to Docker Hub) - Integration tests: Use locally built test image (not from Docker Hub) - Main branch: Tests must pass before build and publish - Removed separate test.yml (functionality merged into ci.yml) Pipeline stages: 1. Script Validation + Unit Tests (parallel) 2. Build Test Image (after stage 1) 3. Integration Tests (using test image artifact) 4. Publish to Docker Hub (main branch only, after all tests pass)
- Use -NoProfile flag for tests that don't need profile functions - Explicitly load profile for tests that need Show-ContainerInfo/info alias - Remove tests for Terminal-Icons/PSReadLine (not installed during build) - Add test for install-modules.sh script existence - Fix OHMYPOSH_THEME test (variable exists but is empty by default)
- Install Terminal-Icons and PSReadLine modules during build instead of creating a manual install script - Modules are now available immediately when container starts - Updated integration tests to verify modules are installed - Removed install-modules.sh script creation from Dockerfile - Updated PowerShell profile welcome message to remove script reference
The container ENTRYPOINT is already set to 'pwsh', so running: docker run ... pwsh -NoProfile -c '...' was executing: pwsh pwsh -NoProfile -c '...' which caused PowerShell to try to run a script named 'pwsh'. Fixed by removing 'pwsh' from all docker run commands since it's already provided by the ENTRYPOINT.
Added badge showcasing the default Oh My Posh theme included in the container, using the theme's signature blue color (#3465a4).
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.
Summary
This PR addresses the Oh My Posh integration feature requests and fixes a critical bug in the .NET version script that was causing Docker builds to fail.
Fixes #3 - Feature Request: Enhanced PowerShell Prompt with Oh My Posh Integration
Fixes #4 - Feature Request: Enhanced PowerShell Prompt with Oh My Posh Integration
🐛 Bug Fix: .NET Version Script
Root Cause
The
scripts/get-net-pwsh-versions.shscript was failing because Microsoft now has TWO active LTS .NET releases:The script's jq query returned both results as a multi-line string, causing:
latest_runtime=10.0.1\n8.0.23(multi-line)releases_json=URL1\nURL2(multi-line)curl "$releases_json"fails with invalid URLNET_RUNTIME_URL_*variables remain emptyFix
Added
first()to jq queries to select only the newest LTS release:✨ Oh My Posh Enhancements
1. Embedded Blue PSL 10K Theme
config/ohmyposh-container.jsonpath_blue(#3465a4) color scheme2. Runtime Environment Variables
true) - Disable Oh My Posh at runtime3. Three-Tier Fallback Hierarchy
4. Container Optimization
/bin/zshto/bin/bash5. Documentation Updates
📋 Files Changed
scripts/get-net-pwsh-versions.shfirst()config/ohmyposh-container.jsonconfig/Microsoft.PowerShell_profile.ps1DockerfileREADME.mdscripts/test-ohmyposh-build.sh✅ Testing Results
Version Script
Docker Build
✅ Build completes successfully for linux/arm64
Container Tests
📝 Checklist
Pull Request opened by Augment Code with guidance from the PR author