1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2025-10-14 15:49:09 +00:00

utility: Detect GNU 'ls' before applying the relevant tweaks

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 commit is contained in:
Indrajit Raychaudhuri
2021-05-01 01:28:09 -05:00
committed by Indrajit Raychaudhuri
parent b14aca307d
commit 424d4cb779
2 changed files with 27 additions and 21 deletions

View File

@@ -2,6 +2,11 @@
Defines general aliases and functions.
**Note:** Some of the utilities configured in this module might be provided via
GNU utilities with incompatible arguments on non-GNU systems. In such cases,
using [*`gnu-utility`*][1] module is recommended and it must be loaded
**before** this module.
## Settings
### Highlighting
@@ -107,7 +112,7 @@ zstyle ':prezto:module:utility' correct 'no'
- `lt` lists sorted by date, most recent last.
- `lc` lists sorted by date, most recent last, shows change time.
- `lu` lists sorted by date, most recent last, shows access time.
- `sl` lists directory contents (`ls`).
- `sl` lists directory contents (correction for `ls`).
### macOS Everywhere
@@ -181,10 +186,11 @@ In addition, the following aliases have been added:
## Authors
*The authors of this module should be contacted via the [issue tracker][1].*
*The authors of this module should be contacted via the [issue tracker][2].*
- [Robby Russell](https://github.com/robbyrussell)
- [Suraj N. Kurapati](https://github.com/sunaku)
- [Sorin Ionescu](https://github.com/sorin-ionescu)
[1]: https://github.com/sorin-ionescu/prezto/issues
[1]: ../gnu-utility#readme
[2]: https://github.com/sorin-ionescu/prezto/issues