utility: Detect GNU 'ls' before applying the relevant tweaks #1917
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
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 thels
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
.ls
in scope anyway can be either GNU Utils provided or BSD Utils provided depending on either$path
precedence, 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 othergls
callable (can happen if 'git' module is used, for example). Besides, honoringgls
would imply we honor other commands (likemv
,rm
etc.) to be consistent. We have a modulegnu-utils
dedicated for that after all.Also closes #1752.