Compare commits

...

2 Commits

Author SHA1 Message Date
mipmip
292c771c72 deploy: f5740ec6fe 2024-04-16 20:02:38 +00:00
mipmip
78f981b0a9 deploy: 12b2c51e7c 2024-04-16 19:59:15 +00:00
7 changed files with 31 additions and 19 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -87,10 +87,7 @@
<option value="master">unstable</option>
<option value="release-23.11">23.11</option>
<option value="release-23.05">23.05</option>
<!--
<option value="release-22.11">22.11</option>
<option value="release-22.05">22.05</option>
-->
</select>
<!--
<label for="advcheck">

View File

@ -10,6 +10,6 @@ fi
echo "building Home Manager options from ${HM_RELEASE}"
rm -Rf result
nix build github:nix-community/home-manager/${HM_RELEASE}#docs-json --no-write-lock-file
nix build github:nix-community/home-manager/${HM_RELEASE}#docs-json --no-write-lock-file
rm -f ./data/hm-options-${HM_RELEASE}.json
ruby ./scripts/parse_options-json.rb

View File

@ -13,24 +13,38 @@ p ENV['HM_RELEASE']
in_file = File.read("./result/share/doc/home-manager/options.json")
parsed = JSON.parse(in_file)
def isLiteralExpression(val, key)
if val.key? key and val[key].instance_of? Hash and val[key].key? "_type" and val[key]['_type'] == 'literalExpression'
true
else
false
end
end
def getValFor(val, key)
if isLiteralExpression(val, key)
val[key]['text']
elsif val.key? key
val[key]
else
""
end
end
def parseVal(val)
val['example'] = getValFor(val, 'example')
val['default'] = getValFor(val, 'default')
val
end
options_arr = []
parsed.each do | name, val |
next if name == '_module.args'
val['title'] = name
if val.key? "example"
val['example'] = val['example']['text']
else
val['example'] = ""
end
if val.key? "default"
val['default'] = val['default']['text']
else
val['default'] = ""
end
val = parseVal(val)
options_arr << val
end