diff options
author | Daiderd Jordan <daiderd@gmail.com> | 2020-04-14 20:29:37 +0200 |
---|---|---|
committer | Daiderd Jordan <daiderd@gmail.com> | 2020-04-14 20:34:07 +0200 |
commit | 31a03daa7239c1372a6761e68f9c9bd81c095dd3 (patch) | |
tree | 3f49fc37a589b82de6b889955111a71082bd68bb /lib | |
parent | 1c951b1484ebf0efc2024dc5fad252bcefe5369b (diff) |
Revert "lib/options: Use escapeNixIdentifier for showOption"
This is used in in the manual generation for option identifiers that can be linked. This, unike what the example describes, doesn't preserve quotes which is needed for these identifiers to be valid. This reverts commit 124cccbe3b63122733e02e41e45a383ec48752fd.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/options.nix | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/options.nix b/lib/options.nix index 7407905131b50..d5006365e54c5 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -200,13 +200,14 @@ rec { Unlike attributes, options can also start with numbers: (showOption ["windowManager" "2bwm" "enable"]) == "windowManager.2bwm.enable" */ - showOption = parts: - let - escapeOptionPart = part: - if part == "*" || builtins.match "<.+>" part != null || builtins.match "[a-zA-Z0-9_][a-zA-Z0-9_'-]+" part != null - then part - else escapeNixIdentifier part; - in concatMapStringsSep "." escapeOptionPart parts; + showOption = parts: let + escapeOptionPart = part: + let + escaped = lib.strings.escapeNixString part; + in if escaped == "\"${part}\"" + then part + else escaped; + in (concatStringsSep ".") (map escapeOptionPart parts); showFiles = files: concatStringsSep " and " (map (f: "`${f}'") files); unknownModule = "<unknown-file>"; |