diff options
author | Alan Pearce | 2024-05-08 09:31:32 +0200 |
---|---|---|
committer | Alan Pearce | 2024-05-08 09:31:32 +0200 |
commit | 9f1a4aaa9960fe3ab664033e1c1f42e62c3fb2e8 (patch) | |
tree | 8cce5bf0cba035a5aa918bf178d3caec1a12cb20 /internal | |
parent | 9315125648a12ebab8bce86b8a0af52dcc8427b0 (diff) | |
download | searchix-9f1a4aaa9960fe3ab664033e1c1f42e62c3fb2e8.tar.lz searchix-9f1a4aaa9960fe3ab664033e1c1f42e62c3fb2e8.tar.zst searchix-9f1a4aaa9960fe3ab664033e1c1f42e62c3fb2e8.zip |
fix: incorrect default/example values stored after processing
Diffstat (limited to 'internal')
-rw-r--r-- | internal/options/process.go | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/internal/options/process.go b/internal/options/process.go index 32a76a2..4e7c664 100644 --- a/internal/options/process.go +++ b/internal/options/process.go @@ -26,9 +26,9 @@ type linkJSON struct { type nixOptionJSON struct { Declarations []linkJSON - Default nixValueJSON + Default *nixValueJSON Description string - Example nixValueJSON + Example *nixValueJSON Loc []string ReadOnly bool RelatedPackages string @@ -80,13 +80,12 @@ func MakeChannelLink(channel string, ref string, subPath string) (*Link, error) }, nil } -func convertNixValue(nj nixValueJSON) *NixValue { +func convertNixValue(nj *nixValueJSON) *NixValue { + if nj == nil { + return nil + } switch nj.Type { case "", "literalExpression": - if nj.Text == "" { - return nil - } - return &NixValue{ Text: nj.Text, } @@ -144,6 +143,8 @@ func Process(inpath string, outpath string, channel string, revision string) err var decls []*Link for _, decl := range x["declarations"].([]interface{}) { + optJSON = nixOptionJSON{} + switch decl := reflect.ValueOf(decl); decl.Kind() { case reflect.String: s := decl.String() |