File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4242 {
4343 help = "prints this menu" ;
4444 name = devshellMenuCommandName ;
45- command = ''
46- cat <<${ ( x : if config . devshell . menu . interpolate then x else "'${ x } '" ) "DEVSHELL_MENU" }
47- ${ commandsToMenu config . commands }
48- DEVSHELL_MENU
49- '' ;
45+ command = commandsToMenu config . devshell . menu config . commands ;
5046 }
5147 ] ;
5248
Original file line number Diff line number Diff line change 4545 then null
4646 else cmd . package ;
4747
48- commandsToMenu = cmds :
48+ commandsToMenu = menuConfig : cmds :
4949 let
5050 cleanName = { name , package , ... } @cmd :
5151 if
@@ -108,16 +108,30 @@ rec {
108108 let
109109 category = kv . name ;
110110 cmd = kv . value ;
111- opCmd = { name , help , ... } :
111+ opCmd = { name , help , interpolate , ... } :
112112 let
113113 len = maxCommandLength - ( lib . stringLength name ) ;
114114 in
115115 if help == null || help == "" then
116- " ${ name } "
116+ "printf ' ${ name } ' "
117117 else
118- " ${ pad name len } - ${ help } " ;
118+ "printf ' ${ pad name len } - '\n " +
119+ (
120+ let
121+ highlyUnlikelyName = "ABDH_OKKD_VOAP_DOEE_PJGD" ;
122+ quotedName = (
123+ x :
124+ if ( if interpolate != null then interpolate else menuConfig . interpolate )
125+ then ''${ x } ''
126+ else "'${ x } '"
127+ )
128+ highlyUnlikelyName ;
129+ in
130+ "cat <<${ quotedName } \n ${ help } \n ${ highlyUnlikelyName } \n "
131+ ) ;
119132 in
120- "\n ${ ansi . bold } [${ category } ]${ ansi . reset } \n \n " + lib . concatStringsSep "\n " ( map opCmd cmd ) ;
133+ ''printf '\n${ ansi . bold } [${ category } ]${ ansi . reset } \n\n''
134+ + "'\n \n " + lib . concatStringsSep "\n " ( map opCmd cmd ) ;
121135 in
122136 lib . concatStringsSep "\n " ( map opCat commandByCategoriesSorted ) + "\n " ;
123137}
You can’t perform that action at this time.
0 commit comments