Use zstyle -T|-t to allow bool-ish values

This commit is contained in:
Pandu POLUAN 2024-02-28 10:40:21 +07:00
parent ab33b5d274
commit c7c7dd81ac
2 changed files with 6 additions and 8 deletions

View file

@ -20,9 +20,9 @@ All configurations are done using the `zstyle` command in the `:omz:plugins:eza`
zstyle ':omz:plugins:eza' 'dirs-first' $BOOL
```
If `1`, directories will be grouped first.
If `true`, directories will be grouped first.
Default: `0`
Default: `false`
### `showgroup`
@ -31,9 +31,9 @@ Default: `0`
zstyle ':omz:plugins:eza' 'showgroup' $BOOL
```
If `1` (default), always add `-g` flag to show the group ownership.
If `true` (default), always add `-g` flag to show the group ownership.
Default: `1`
Default: `true`
### `time-style`

View file

@ -9,13 +9,11 @@ typeset -a _EZA_TAIL
function _configure_eza() {
local _val
# Get the head flags
zstyle -s ':omz:plugins:eza' 'showgroup' _val
if [[ -z $_val || $_val == 1 ]]; then
if zstyle -T ':omz:plugins:eza' 'showgroup'; then
_EZA_HEAD+=("g")
fi
# Get the tail long-options
zstyle -s ':omz:plugins:eza' 'dirs-first' _val
if [[ $_val == 1 ]]; then
if zstyle -t ':omz:plugins:eza' 'dirs-first'; then
_EZA_TAIL+=("--group-directories-first")
fi
zstyle -s ':omz:plugins:eza' 'time-style' _val