Require README.md for every clan module
This commit is contained in:
parent
853d8221c0
commit
a09e680fa0
|
@ -1,7 +1,7 @@
|
||||||
Syncthing is a free, open-source file synchronization application designed to allow users to synchronize files between multiple devices over the internet or local networks securely and privately.
|
Syncthing is a free, open-source file synchronization application designed to allow users to synchronize files between multiple devices over the internet or local networks securely and privately.
|
||||||
|
|
||||||
It is an alternative to cloud-based file sharing services.
|
It is an alternative to cloud-based file sharing services.
|
||||||
|
---
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
We recommend configuring this module as an sync-service through the provided options. Although it provides a Web GUI through which more usage scenarios are supported.
|
We recommend configuring this module as an sync-service through the provided options. Although it provides a Web GUI through which more usage scenarios are supported.
|
||||||
|
|
|
@ -38,7 +38,7 @@ let
|
||||||
) clanModules;
|
) clanModules;
|
||||||
|
|
||||||
clanModulesReadmes = builtins.mapAttrs (
|
clanModulesReadmes = builtins.mapAttrs (
|
||||||
module_name: _module: self.lib.modules.getDescription module_name
|
module_name: _module: self.lib.modules.getReadme module_name
|
||||||
) clanModules;
|
) clanModules;
|
||||||
|
|
||||||
# clanCore docs
|
# clanCore docs
|
||||||
|
|
|
@ -1,19 +1,26 @@
|
||||||
{ clan-core, ... }:
|
{ clan-core, ... }:
|
||||||
|
|
||||||
{
|
rec {
|
||||||
getDescription =
|
getReadme =
|
||||||
modulename:
|
modulename:
|
||||||
let
|
let
|
||||||
readme = "${clan-core}/clanModules/${modulename}/README.md";
|
readme = "${clan-core}/clanModules/${modulename}/README.md";
|
||||||
readmeContents =
|
readmeContents =
|
||||||
if
|
if (builtins.pathExists readme) then
|
||||||
builtins.trace "Trying to get Module README.md for ${modulename} from ${readme}"
|
|
||||||
# TODO: Edge cases
|
|
||||||
(builtins.pathExists readme)
|
|
||||||
then
|
|
||||||
(builtins.readFile readme)
|
(builtins.readFile readme)
|
||||||
else
|
else
|
||||||
null;
|
throw "No README.md found for module ${modulename}";
|
||||||
in
|
in
|
||||||
readmeContents;
|
readmeContents;
|
||||||
|
|
||||||
|
getShortDescription =
|
||||||
|
modulename:
|
||||||
|
let
|
||||||
|
content = (getReadme modulename);
|
||||||
|
parts = builtins.split "---" content;
|
||||||
|
in
|
||||||
|
if (builtins.length parts) > 0 then
|
||||||
|
builtins.head parts
|
||||||
|
else
|
||||||
|
throw "Short description delimiter `---` not found in README.md for module ${modulename}";
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
clanModuleFunctionSchemas = lib.mapAttrsFlatten (modulename: module: {
|
clanModuleFunctionSchemas = lib.mapAttrsFlatten (modulename: module: {
|
||||||
name = modulename;
|
name = modulename;
|
||||||
description = self.lib.modules.getDescription modulename;
|
description = self.lib.modules.getShortDescription modulename;
|
||||||
parameters = self.lib.jsonschema.parseOptions (optionsFromModule modulename module);
|
parameters = self.lib.jsonschema.parseOptions (optionsFromModule modulename module);
|
||||||
}) clanModules;
|
}) clanModules;
|
||||||
in
|
in
|
||||||
|
|
Loading…
Reference in New Issue
Block a user