Skip to content

Commit

Permalink
lib/generators: mkKeyValueLine -> mkKeyValueLine (#20920)
Browse files Browse the repository at this point in the history
Rename, since the previous name was potentially confusing.
  • Loading branch information
Profpatsch committed Dec 6, 2016
1 parent 80f2e53 commit 271c0f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/generators.nix
Expand Up @@ -21,10 +21,10 @@ rec {
* character sep. If sep appears in k, it is escaped.
* Helper for synaxes with different separators.
*
* mkKeyValueLine ":" "f:oo" "bar"
* mkKeyValueDefault ":" "f:oo" "bar"
* > "f\:oo:bar"
*/
mkKeyValueLine = sep: k: v:
mkKeyValueDefault = sep: k: v:
"${libStr.escape [sep] k}${sep}${toString v}";


Expand All @@ -33,7 +33,7 @@ rec {
* mkKeyValue is the same as in toINI.
*/
toKeyValue = {
mkKeyValue ? mkKeyValueLine "="
mkKeyValue ? mkKeyValueDefault "="
}: attrs:
let mkLine = k: v: mkKeyValue k v + "\n";
in libStr.concatStrings (libAttr.mapAttrsToList mkLine attrs);
Expand Down Expand Up @@ -63,7 +63,7 @@ rec {
# apply transformations (e.g. escapes) to section names
mkSectionName ? (name: libStr.escape [ "[" "]" ] name),
# format a setting line from key and value
mkKeyValue ? mkKeyValueLine "="
mkKeyValue ? mkKeyValueDefault "="
}: attrsOfAttrs:
let
# map function to string for each key val
Expand Down
4 changes: 2 additions & 2 deletions lib/tests.nix
Expand Up @@ -135,8 +135,8 @@ runTests {
# these tests assume attributes are converted to lists
# in alphabetical order

testMkKeyValueLine = {
expr = generators.mkKeyValueLine ":" "f:oo" "bar";
testMkKeyValueDefault = {
expr = generators.mkKeyValueDefault ":" "f:oo" "bar";
expected = ''f\:oo:bar'';
};

Expand Down

0 comments on commit 271c0f5

Please sign in to comment.