utility: Detect GNU 'ls' before applying the relevant tweaks#1917
Merged
indrajitr merged 1 commit intosorin-ionescu:masterfrom May 21, 2021
Merged
utility: Detect GNU 'ls' before applying the relevant tweaks#1917indrajitr merged 1 commit intosorin-ionescu:masterfrom
indrajitr merged 1 commit intosorin-ionescu:masterfrom
Conversation
Collaborator
Author
3748e69 to
460c11e
Compare
Detect `ls` provided by GNU Core Utilities upfront before applying the relevant settings and aliases. The revised logic takes the following aspects into consideration: - `is-callable 'dircolors'` is not a sufficient test for verifying if the `ls` in scope is _also_ provided by GNU Core Utilities. `ls` can continue to be the one provided by BSD Core Utilities because of its precedence in `$path`. - The `ls` in scope anyway can be either GNU Utils provided or BSD Utils provided depending on either `$path` precedence, soft link (via `ln -s`), or wrapper function (via 'gnu-utility' module). - So instead of '_guessing_' the possible one, just detect if it is from GNU Utils and apply the relevant settings and aliases. - Note that GNU prefixed `ls` (`gls`) is intentionally not honored in this case to avoid possible conflict/shadowing with other `gls` callable (can happen if 'git' module is used, for example). Besides, honoring `gls` would imply we honor other commands (like `mv`, `rm` etc.) to be consistent. We have a module 'gnu-utils' dedicated for that after all.
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.
Detect
lsprovided by GNU Core Utilities upfront before applying the relevant settings and aliases.The revised logic takes the following aspects into consideration:
is-callable 'dircolors'is not a sufficient test for verifying if thelsin scope is also provided by GNU Core Utilities.lscan continue to be the one provided by BSD Core Utilities because of its precedence in$path.lsin scope anyway can be either GNU Utils provided or BSD Utils provided depending on either$pathprecedence, soft link (vialn -s), or wrapper function (via 'gnu-utility' module).ls(gls) is intentionally not honored in this case to avoid possible conflict/shadowing with otherglscallable (can happen if 'git' module is used, for example). Besides, honoringglswould imply we honor other commands (likemv,rmetc.) to be consistent. We have a modulegnu-utilsdedicated for that after all.Also closes #1752.