mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 11:36:05 +01:00
lib/zsh: fix shell escaping and integrate formatShellArrayContent
Replace naive string quoting with lib.escapeShellArg for proper shell escaping of special characters, spaces, and quotes. Integrate with new formatShellArrayContent for intelligent multi-line array formatting in zsh array definitions. Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
parent
a8dbb4e325
commit
5176d93c0a
3 changed files with 8 additions and 5 deletions
|
|
@ -7,9 +7,12 @@ rec {
|
|||
if builtins.isBool v then
|
||||
if v then "true" else "false"
|
||||
else if builtins.isString v then
|
||||
''"${v}"''
|
||||
lib.escapeShellArg v
|
||||
else if builtins.isList v then
|
||||
"(${lib.concatStringsSep " " (map toZshValue v)})"
|
||||
let
|
||||
shell = import ./shell.nix { inherit lib; };
|
||||
in
|
||||
"(${shell.formatShellArrayContent (map toString v)})"
|
||||
else
|
||||
''"${toString v}"'';
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue