eza: fix icons option
Fixes the icons option for eza which was breaking completion in zsh.
This commit is contained in:
parent
e1aec543f5
commit
2a4fd1cfd8
2 changed files with 25 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue