mirror of
https://github.com/h7x4/nix-attr-search.git
synced 2025-01-14 05:54:47 +01:00
h7x4
f6217e4c54
The project has grown quite a bit without me remembering to make any commits... Here's a summary of what has happened: - Make the project friendly towards non-flake users - Add searchers to be created: `nur-package-search`, `nix-lib-search` - Add misc util scripts for formatting and testing code. - Split templates into their own directory, as they get quite large after a while. - Add colorized templates. - Replace some of the xml tags with optionally colorized output. - Add `--no-color` option - Add json2nix script, which will convert the json-converted nix code back into nix.
55 lines
1.3 KiB
Nix
55 lines
1.3 KiB
Nix
{ pkgs }:
|
|
let inherit (pkgs.callPackage ../internals/lib.nix { }) flatten;
|
|
in pkgs.writeText "nix-attrs-search-internal-option-template" (flatten ''
|
|
{{ with (ds "opt")}}
|
|
{{- $origTitle := join .loc "." }}
|
|
{{- $title := join .loc "." }}
|
|
{{- $title }}
|
|
{{ strings.Repeat (strings.RuneCount $origTitle) "=" }}
|
|
|
|
{{ if .readOnly }}
|
|
READONLY
|
|
{{ end }}
|
|
|
|
Type: {{ .type }}
|
|
|
|
{{ if has . "description" }}
|
|
DESCRIPTION
|
|
{{ strings.Repeat 20 "=" }}
|
|
{{ getenv "DESCRIPTION" "Gomplate error: could not fetch description" }}
|
|
{{ end }}
|
|
|
|
{{- if has . "example" }}
|
|
EXAMPLE
|
|
{{ strings.Repeat 20 "=" }}
|
|
{{ getenv "EXAMPLE" "Gomplate error: could not fetch example" }}
|
|
{{ end }}
|
|
|
|
{{- if has . "default" }}
|
|
DEFAULT
|
|
{{ strings.Repeat 20 "=" }}
|
|
{{ getenv "DEFAULT" "Gomplate error: could not fetch default value" }}
|
|
{{ end }}
|
|
|
|
{{- if has . "declarations" }}
|
|
CONFIGURED IN
|
|
{{ strings.Repeat 20 "=" }}
|
|
{{ range .declarations }}
|
|
{{- .path }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{- if has . "relatedPackages" }}
|
|
RELATED PACKAGES:
|
|
{{ strings.Repeat 20 "=" }}
|
|
{{ range .relatedPackages }}
|
|
{{- .attrName }}
|
|
{{- .description }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ else }}
|
|
ERROR: Could not find datasource
|
|
{{ end }}
|
|
'')
|