feat(soe): enable ls/grep colour using each OS's own defaults - #79
Open
catinspace-au wants to merge 1 commit into
Open
feat(soe): enable ls/grep colour using each OS's own defaults#79catinspace-au wants to merge 1 commit into
catinspace-au wants to merge 1 commit into
Conversation
Colouring is off on any box whose home directory did not come from the distro's own skel - a Fedora-derived .bashrc on Ubuntu leaves LS_COLORS empty and no ls alias, so ls and the prompt render monochrome. Uses only what each OS ships, nothing installed. GNU ls (Linux, or macOS with brew coreutils) reads LS_COLORS; BSD ls ignores LS_COLORS entirely and reads LSCOLORS, so the block detects which ls it has at shell start. Colours are ANSI indices rather than RGB, so they track the terminal theme and need no light/dark handling: Solarized keeps 14 of 16 palette slots identical across its light and dark variants. Goes in the interactive shell rc, not /etc/profile.d - aliases are not exported, and Ubuntu ships its profile.d hook commented out in /etc/bash.bashrc, so a terminal's non-login shell never reads it. System-wide by default, soe_ls_colour_scope=user for a single account.
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.
Colouring is off on any box whose home directory did not come from the distro's own skel. A Fedora-derived
.bashrcon Ubuntu leavesLS_COLORSempty with nolsalias, solsand the prompt render monochrome.Uses only what each OS ships, nothing installed. GNU
ls(Linux, or macOS with coreutils on PATH) readsLS_COLORS; BSDlsignoresLS_COLORSentirely and readsLSCOLORS, so the block detects whichlsit has at shell start.Colours are ANSI indices rather than RGB, so they track the terminal theme and need no light/dark handling of their own — Solarized keeps 14 of 16 palette slots identical across its light and dark variants.
Goes in the interactive shell rc, not
/etc/profile.d: aliases are not exported, and Ubuntu ships its profile.d hook commented out in/etc/bash.bashrc, so a terminal's non-login shell never reads it.System-wide by default;
soe_ls_colour_scope=userwrites to the invoking user's rc instead and needs no root.system/etc/bash.bashrc/etc/bashrc/etc/zshrcuser~/.bashrc~/.bashrc~/.zshrcVerification
/etc/bash.bashrc,LS_COLORS1753 chars, alias set, root sees it too, second runchanged=0/etc/zshrc, took the BSD branch correctly (plaindircolorsnot on PATH),lsemits bold blue dirs / bold magenta symlinks/etc/bashrcpath and the colorls.sh no-op assumption are unverifiedansible-lint+yamllintclean for the new section; the remaining failures are pre-existing on mainNote
macOS and Linux will not match colour-for-colour:
LSCOLORShas 11 slots,LS_COLORShas dozens. Closing that gap needs coreutils' gnubin on PATH, which was deliberately not done.