File tree Expand file tree Collapse file tree 3 files changed +37
-5
lines changed
tests/modules/programs/less Expand file tree Collapse file tree 3 files changed +37
-5
lines changed Original file line number Diff line number Diff line change 4343 int
4444 str
4545 ] ;
46+ attrs = attrsOf ( either scalar ( listOf scalar ) ) ;
4647 in
47- attrsOf ( either scalar ( listOf scalar ) ) ;
48- default = { } ;
49- description = "GNU-style options to be set via {env}`$LESS`." ;
48+ coercedTo attrs ( lib . cli . toGNUCommandLine { } ) ( listOf str ) ;
49+ default = [ ] ;
50+ description = "Options to be set via {env}`$LESS`." ;
5051 example = {
5152 RAW-CONTROL-CHARS = true ;
5253 quiet = true ;
6162
6263 xdg . configFile . "lesskey" = lib . mkIf ( cfg . config != "" ) { text = cfg . config ; } ;
6364
64- programs . less . config = lib . mkIf ( cfg . options != { } ) (
65+ programs . less . config = lib . mkIf ( cfg . options != [ ] ) (
6566 lib . mkBefore ''
6667 #env
67- LESS = ${ lib . cli . toGNUCommandLineShell { } cfg . options }
68+ LESS = ${ lib . concatStringsSep " " cfg . options }
6869 ''
6970 ) ;
7071 } ;
Original file line number Diff line number Diff line change 1+ { lib , ... } :
2+
3+ {
4+ programs . less = {
5+ enable = true ;
6+ options = lib . mkMerge [
7+ {
8+ quiet = true ;
9+ use-color = true ;
10+ }
11+ ( lib . mkAfter {
12+ color = [
13+ "HkK" # header: gray
14+ "Mkb" # marks: blue
15+ ] ;
16+ } )
17+ ( lib . mkOrder 2000 {
18+ prompt = "s%f" ;
19+ } )
20+ ] ;
21+ } ;
22+
23+ nmt . script = ''
24+ assertFileExists home-files/.config/lesskey
25+ assertFileContent home-files/.config/lesskey ${ builtins . toFile "lesskey.expected" ''
26+ #env
27+ LESS = --quiet --use-color --color HkK --color Mkb --prompt s%f
28+ '' }
29+ '' ;
30+ }
Original file line number Diff line number Diff line change 11{
2+ less-correct-option-order = ./correct-option-order.nix ;
23 less-custom-config = ./custom-config.nix ;
34 less-custom-options = ./custom-options.nix ;
45 less-custom-options-and-config = ./custom-options-and-config.nix ;
You can’t perform that action at this time.
0 commit comments