eza: fix icons option

Fixes the icons option for eza which was breaking completion in zsh.
This commit is contained in:
Sergey 2024-10-08 22:34:31 +01:00 committed by Robert Helgesson
parent e1aec543f5
commit 2a4fd1cfd8
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED
2 changed files with 25 additions and 4 deletions

View file

@ -18,6 +18,11 @@ This release has the following notable changes:
add `-w` to your assignment of
[services.swayidle.extraArgs](#opt-services.swayidle.extraArgs).
- Support for Boolean values in the option
[programs.eza.icons](#opt-programs.eza.icons) is deprecated for
future removal. The new value for `true` is `"auto"`, and for
`false` it is `null`.
## State Version Changes {#sec-release-24.11-state-version-changes}
The state version in this release includes the changes below. These

View file

@ -49,10 +49,13 @@ with lib;
};
icons = mkOption {
type = types.bool;
default = false;
type = types.enum [ null true false "auto" "always" "never" ];
default = null;
description = ''
Display icons next to file names ({option}`--icons` argument).
Note, the support for Boolean values is deprecated.
Setting this option to `true` corresponds to `--icons=auto`.
'';
};
@ -70,8 +73,15 @@ with lib;
config = let
cfg = config.programs.eza;
args = escapeShellArgs (optional cfg.icons "--icons"
++ optional cfg.git "--git" ++ cfg.extraOptions);
iconsOption = let
v = if isBool cfg.icons then
(if cfg.icons then "auto" else null)
else
cfg.icons;
in optionals (v != null) [ "--icons" v ];
args = escapeShellArgs
(iconsOption ++ optional cfg.git "--git" ++ cfg.extraOptions);
optionsAlias = optionalAttrs (args != "") { eza = "eza ${args}"; };
@ -83,6 +93,12 @@ with lib;
lla = "eza -la";
};
in mkIf cfg.enable {
warnings = optional (isBool cfg.icons) ''
Setting programs.eza.icons to a Boolean is deprecated.
Please update your configuration so that
programs.eza.icons = ${if cfg.icons then ''"auto"'' else "null"}'';
home.packages = [ cfg.package ];
programs.bash.shellAliases = optionsAlias