all repos — searchix @ 49fda418f21c8bb8fd19095890ed2d04c8a57030

Search engine for NixOS, nix-darwin, home-manager and NUR users

feat: enumerate all hierarchical paths for option's parents facet

Alin
commit

49fda418f21c8bb8fd19095890ed2d04c8a57030

parent

bc8f40ec805cbc9771efe0992bbb666d46793f0e

2 files changed, 9 insertions(+), 6 deletions(-)

changed files
M internal/importer/options.gointernal/importer/options.go
@@ -172,14 +172,17 @@ if v, ok := x["example"].(map[string]any); ok {
exampleDocs = i.convertDocsValue(v) } - var parents string - if len(loc) > 1 { - parents = strings.Join(loc[:len(loc)-1], ".") - } - var optionSet string + var parents []string if len(loc) >= 1 { + // Top-level parent -> optionSet optionSet = loc[0] + + for i := 1; i < len(loc); i++ { + parents = append(parents, + strings.Join(loc[:i], "."), + ) + } } // log.Debug("sending option", "name", kv.Key)
M internal/nix/option.gointernal/nix/option.go
@@ -26,7 +26,7 @@ Description nixdocs.Markdown
Example *Docs `json:",omitempty"` Loc []string OptionSet string - Parents string + Parents []string RelatedPackages nixdocs.Markdown `json:",omitempty"` Type string ImportedAt time.Time