Throw error on missing clanModule description or if description too long. Add xfce description.

This commit is contained in:
Qubasa
2024-05-02 17:53:27 +02:00
parent 810b44e338
commit 82773f260a
4 changed files with 14 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
{ clan-core, ... }:
{ lib, clan-core, ... }:
rec {
getReadme =
@@ -17,10 +17,17 @@ rec {
modulename:
let
content = (getReadme modulename);
parts = builtins.split "---" content;
parts = lib.splitString "---" content;
description = builtins.head parts;
number_of_newlines = builtins.length (lib.splitString "\n" description);
in
if (builtins.length parts) > 0 then
builtins.head parts
if (builtins.length parts) > 1 then
if number_of_newlines > 4 then
throw "Short description in README.md for module ${modulename} is too long. Max 3 newlines."
else if number_of_newlines <= 1 then
throw "Missing short description in README.md for module ${modulename}."
else
description
else
throw "Short description delimiter `---` not found in README.md for module ${modulename}";
}