fix(helpers): use "__unkeyed" prefix instead of "@" in toLuaObject (#632)

This commit is contained in:
municorn 2023-10-09 08:50:21 -05:00 committed by GitHub
parent 258acc56a9
commit 934bf7e2e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 15 deletions

View file

@ -21,7 +21,7 @@ with lib; rec {
+ (concatStringsSep "," + (concatStringsSep ","
(mapAttrsToList (mapAttrsToList
(n: v: (n: v:
if head (stringToCharacters n) == "@" if (builtins.match "__unkeyed.*" n) != null
then toLuaObject v then toLuaObject v
else if n == "__emptyString" else if n == "__emptyString"
then "[''] = " + (toLuaObject v) then "[''] = " + (toLuaObject v)

View file

@ -990,7 +990,7 @@ in {
name: value: { name: value: {
name = name =
if name == "name" if name == "name"
then "@" then "__unkeyed"
else name; else name;
value = value =
if isList value if isList value
@ -1011,7 +1011,7 @@ in {
mapAttrs' (k: v: { mapAttrs' (k: v: {
name = name =
if k == "command" if k == "command"
then "@" then "__unkeyed"
else k; else k;
value = v; value = v;
}) })

View file

@ -144,7 +144,7 @@ in {
(k: v: { (k: v: {
name = name =
if k == "name" if k == "name"
then "@" then "__unkeyed"
else k; else k;
value = v; value = v;
}) })
@ -155,7 +155,7 @@ in {
pluginToLua = plugin: pluginToLua = plugin:
if isAttrs plugin if isAttrs plugin
then { then {
"@" = plugin.name; "__unkeyed" = plugin.name;
inherit (plugin) disable as; inherit (plugin) disable as;

View file

@ -210,7 +210,7 @@ in {
}: }:
mergeAttrs mergeAttrs
{ {
"@" = name; "__unkeyed" = name;
inherit icons_enabled icon separator color padding; inherit icons_enabled icon separator color padding;
} }
extraConfig; extraConfig;

View file

@ -338,35 +338,35 @@ in {
{ {
columns = with cfg.columns; columns = with cfg.columns;
(optional type.enable { (optional type.enable {
"@" = "type"; "__unkeyed" = "type";
inherit (type) highlight icons; inherit (type) highlight icons;
}) })
++ (optional icon.enable { ++ (optional icon.enable {
"@" = "icon"; "__unkeyed" = "icon";
inherit (icon) highlight defaultFile directory; inherit (icon) highlight defaultFile directory;
}) })
++ (optional size.enable { ++ (optional size.enable {
"@" = "size"; "__unkeyed" = "size";
inherit (size) highlight; inherit (size) highlight;
}) })
++ (optional permissions.enable { ++ (optional permissions.enable {
"@" = "permissions"; "__unkeyed" = "permissions";
inherit (permissions) highlight; inherit (permissions) highlight;
}) })
++ (optional ctime.enable { ++ (optional ctime.enable {
"@" = "ctime"; "__unkeyed" = "ctime";
inherit (ctime) highlight format; inherit (ctime) highlight format;
}) })
++ (optional mtime.enable { ++ (optional mtime.enable {
"@" = "mtime"; "__unkeyed" = "mtime";
inherit (mtime) highlight format; inherit (mtime) highlight format;
}) })
++ (optional atime.enable { ++ (optional atime.enable {
"@" = "atime"; "__unkeyed" = "atime";
inherit (atime) highlight format; inherit (atime) highlight format;
}) })
++ (optional birthtime.enable { ++ (optional birthtime.enable {
"@" = "birthtime"; "__unkeyed" = "birthtime";
inherit (birthtime) highlight format; inherit (birthtime) highlight format;
}); });
buf_opions = cfg.bufOptions; buf_opions = cfg.bufOptions;

View file

@ -23,7 +23,7 @@
testToLuaObjectLuaTableMixingList = { testToLuaObjectLuaTableMixingList = {
expr = helpers.toLuaObject { expr = helpers.toLuaObject {
"@...." = "foo"; "__unkeyed...." = "foo";
bar = "baz"; bar = "baz";
}; };
expected = ''{"foo",["bar"] = "baz"}''; expected = ''{"foo",["bar"] = "baz"}'';