mirror of
https://github.com/mipmip/home-manager-option-search.git
synced 2024-09-11 15:16:31 +03:00
Compare commits
2 Commits
a60a47247b
...
292c771c72
Author | SHA1 | Date | |
---|---|---|---|
|
292c771c72 | ||
|
78f981b0a9 |
File diff suppressed because one or more lines are too long
1
data/hm-options-release-22.11.json
Normal file
1
data/hm-options-release-22.11.json
Normal file
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
@ -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">
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user