fixup! refactor: extract function to lib

This commit is contained in:
Ching Pei Yang 2024-04-20 15:15:31 +02:00
parent b38886d25d
commit f5270d30a9
1 changed files with 5 additions and 6 deletions

View File

@ -49,16 +49,15 @@ in {
batchRenameOptions = oldBasePath: newBasePath: mappings: let
genSetupOptRenames = oldSubpath: newSubpath: table:
mapAttrsToList (
oldName: newNameOrAttr:
if builtins.isAttrs newNameOrAttr
oldName: newNameOrNestedOpts:
if builtins.isAttrs newNameOrNestedOpts
then
genSetupOptRenames (oldSubpath ++ [oldName]) (newSubpath
++ [newNameOrAttr._name or oldName])
newNameOrAttr
genSetupOptRenames (oldSubpath ++ [oldName]) (newSubpath ++ [newNameOrNestedOpts._name or oldName])
(builtins.removeAttrs newNameOrNestedOpts ["_name"])
else
mkRenamedOptionModule
(oldBasePath ++ oldSubpath ++ [oldName])
(newBasePath ++ newSubpath ++ [newNameOrAttr])
(newBasePath ++ newSubpath ++ [newNameOrNestedOpts])
)
table;
in