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.
28 lines
725 B
Python
28 lines
725 B
Python
import json
|
|
import sys
|
|
|
|
options = json.load(sys.stdin)
|
|
for (name, value) in options.items():
|
|
print('##', name.replace('<', '\\<').replace('>', '\\>'))
|
|
print(value['description'])
|
|
print()
|
|
if 'type' in value:
|
|
print('*_Type_*:')
|
|
print(value['type'])
|
|
print()
|
|
print()
|
|
if 'default' in value:
|
|
print('*_Default_*')
|
|
print('```')
|
|
print(json.dumps(value['default'], ensure_ascii=False, separators=(',', ':')))
|
|
print('```')
|
|
print()
|
|
print()
|
|
if 'example' in value:
|
|
print('*_Example_*')
|
|
print('```')
|
|
print(json.dumps(value['example'], ensure_ascii=False, separators=(',', ':')))
|
|
print('```')
|
|
print()
|
|
print()
|