mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-10-30 22:21:26 +00:00
lib/options: Use escapeNixIdentifier for showOption
This commit is contained in:
parent
f9eb3d158a
commit
124cccbe3b
@ -193,14 +193,7 @@ rec {
|
||||
(showOption ["foo" "bar" "baz"]) == "foo.bar.baz"
|
||||
(showOption ["foo" "bar.baz" "tux"]) == "foo.\"bar.baz\".tux"
|
||||
*/
|
||||
showOption = parts: let
|
||||
escapeOptionPart = part:
|
||||
let
|
||||
escaped = lib.strings.escapeNixString part;
|
||||
in if escaped == "\"${part}\""
|
||||
then part
|
||||
else escaped;
|
||||
in (concatStringsSep ".") (map escapeOptionPart parts);
|
||||
showOption = parts: concatMapStringsSep "." escapeNixIdentifier parts;
|
||||
showFiles = files: concatStringsSep " and " (map (f: "`${f}'") files);
|
||||
unknownModule = "<unknown-file>";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user