Merge pull request 'Throw error on missing clanModule description or if description too long. Add xfce description.' (#1306) from Qubasa-main into main

This commit is contained in:
clan-bot
2024-05-02 16:00:32 +00:00
4 changed files with 14 additions and 5 deletions

View File

@@ -1 +1,2 @@
A lightweight desktop manager
---

View File

@@ -1 +1,2 @@
Enable ZeroTier VPN over TCP for networks where UDP is blocked.
---

View File

@@ -6,6 +6,6 @@
}:
{
jsonschema = import ./jsonschema { inherit lib; };
modules = import ./description.nix { inherit clan-core; };
modules = import ./description.nix { inherit clan-core lib; };
buildClan = import ./build-clan { inherit clan-core lib nixpkgs; };
}

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}";
}