less: list options in correct order

This commit is contained in:
Benedikt Rips 2025-11-23 15:42:16 +01:00 committed by Austin Horstman
parent 07d79726f1
commit d787ec69c3
3 changed files with 37 additions and 5 deletions

View file

@ -43,10 +43,11 @@ in
int
str
];
attrs = attrsOf (either scalar (listOf scalar));
in
attrsOf (either scalar (listOf scalar));
default = { };
description = "GNU-style options to be set via {env}`$LESS`.";
coercedTo attrs (lib.cli.toGNUCommandLine { }) (listOf str);
default = [ ];
description = "Options to be set via {env}`$LESS`.";
example = {
RAW-CONTROL-CHARS = true;
quiet = true;
@ -61,10 +62,10 @@ in
xdg.configFile."lesskey" = lib.mkIf (cfg.config != "") { text = cfg.config; };
programs.less.config = lib.mkIf (cfg.options != { }) (
programs.less.config = lib.mkIf (cfg.options != [ ]) (
lib.mkBefore ''
#env
LESS = ${lib.cli.toGNUCommandLineShell { } cfg.options}
LESS = ${lib.concatStringsSep " " cfg.options}
''
);
};