Skip to content

Commit 7de48da

Browse files
committed
fix broken pascal case usage
1 parent e3b0ae9 commit 7de48da

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

modules/jellyfin/default.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ with lib; let
99
inherit (config.nixflix) globals;
1010
cfg = config.nixflix.jellyfin;
1111
xml = import ./xml.nix {inherit lib;};
12+
util = import ./util.nix {inherit lib;};
1213

1314
networkXmlContent = xml.mkXmlContent "NetworkConfiguration" cfg.network;
1415
brandingXmlContent = xml.mkXmlContent "BrandingOptions" cfg.branding;
@@ -105,7 +106,7 @@ with lib; let
105106
})
106107
(nonDBOptions ++ ["id" "internalId"]);
107108

108-
dbColumns = map (name: xml.toPascalCase name) (attrNames userAttrs);
109+
dbColumns = map (name: util.toPascalCase name) (attrNames userAttrs);
109110
dbValues = map (name: sqliteFormat name userAttrs.${name}) (attrNames userAttrs);
110111
in ''
111112
userExists=$(${sq} "SELECT 1 FROM Users WHERE Username = '${username}'" 2>/dev/null || echo "")

modules/jellyfin/util.nix

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{lib, ...}:
2+
with lib; {
3+
toPascalCase = str: let
4+
firstChar = substring 0 1 str;
5+
rest = substring 1 (-1) str;
6+
in
7+
(toUpper firstChar) + rest;
8+
}

modules/jellyfin/xml.nix

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
{lib, ...}:
22
with lib; let
3-
toPascalCase = str: let
4-
firstChar = substring 0 1 str;
5-
rest = substring 1 (-1) str;
6-
in
7-
(toUpper firstChar) + rest;
3+
util = import ./util.nix {inherit lib;};
84

95
escapeXml = str:
106
builtins.replaceStrings
@@ -35,7 +31,7 @@ with lib; let
3531
else
3632
concatStringsSep "\n" (
3733
mapAttrsToList (name: value: let
38-
tagName = toPascalCase name;
34+
tagName = util.toPascalCase name;
3935
valueStr =
4036
if isBool value
4137
then

0 commit comments

Comments
 (0)