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.
main
Indrajit Raychaudhuri4 years agocommitted byIndrajit Raychaudhuri