Skip to content

Add PowerShell colorization for dir and command line syntax#3

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/implement-minimal-powershell-color
Draft

Add PowerShell colorization for dir and command line syntax#3
Copilot wants to merge 3 commits intomainfrom
copilot/implement-minimal-powershell-color

Conversation

Copy link
Contributor

Copilot AI commented Dec 13, 2025

Implements color output for PowerShell dir command following .dircolors mappings, and minimal command-line syntax highlighting (variables and parameters only).

Changes

  • Custom dir function: Overrides built-in alias to colorize output based on file type

    • Directories (cyan), text/source files (green), media (yellow), documents (red), archives (magenta), executables (red)
    • Maps ANSI codes from .dircolors to PowerShell console colors
    • Handles Unix executable permissions and Windows file extensions
  • PSReadLine configuration: Highlights variables ($var) and parameters (-param) in green

  • Compatibility: OS detection works across PowerShell 5.1+ (pre-Core and Core)

Example

# In /tmp/test_dir with mixed file types
PS> dir

subdir          # Cyan
README.md       # Green
test.py         # Green
test.jpg        # Yellow
test.zip        # Magenta
test.exe        # Red

Command-line editing will show $myVariable and -Path in green during interactive use.

Original prompt

Implement a minimal PowerShell color for:

  • dir command, following colors in .dircolors
  • command line, where the only highlights should be green for variables and parameters

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits December 13, 2025 18:50
Co-authored-by: calind <266375+calind@users.noreply.github.com>
Co-authored-by: calind <266375+calind@users.noreply.github.com>
Copilot AI changed the title [WIP] Add minimal PowerShell color configuration for dir command Add PowerShell colorization for dir and command line syntax Dec 13, 2025
Copilot AI requested a review from calind December 13, 2025 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants