forked from mirrors/nixpkgs
4670400309
use the json file derivation we already have to also generate the asciidoc and md options docs instead of formatting the options in nix. docbook docs are already produced in derivations. the new script produce the exact same output as the old in-nix generation.
38 lines
945 B
Python
38 lines
945 B
Python
import json
|
|
import sys
|
|
|
|
options = json.load(sys.stdin)
|
|
# TODO: declarations: link to github
|
|
for (name, value) in options.items():
|
|
print(f'== {name}')
|
|
print()
|
|
print(value['description'])
|
|
print()
|
|
print('[discrete]')
|
|
print('=== details')
|
|
print()
|
|
print(f'Type:: {value["type"]}')
|
|
if 'default' in value:
|
|
print('Default::')
|
|
print('+')
|
|
print('----')
|
|
print(json.dumps(value['default'], ensure_ascii=False, separators=(',', ':')))
|
|
print('----')
|
|
print()
|
|
else:
|
|
print('No Default:: {blank}')
|
|
if value['readOnly']:
|
|
print('Read Only:: {blank}')
|
|
else:
|
|
print()
|
|
if 'example' in value:
|
|
print('Example::')
|
|
print('+')
|
|
print('----')
|
|
print(json.dumps(value['example'], ensure_ascii=False, separators=(',', ':')))
|
|
print('----')
|
|
print()
|
|
else:
|
|
print('No Example:: {blank}')
|
|
print()
|