mirror of
https://gitlab.com/simple-nixos-mailserver/nixos-mailserver.git
synced 2025-05-17 08:00:49 +05:00
scripts/generate-options: fix typing issue
This commit is contained in:
parent
1615c93511
commit
f9fcbe9430
@ -33,7 +33,9 @@ groups = ["mailserver.loginAccounts",
|
||||
"mailserver.borgbackup"]
|
||||
|
||||
def render_option_value(opt, attr):
|
||||
if attr in opt:
|
||||
if attr not in opt:
|
||||
return ""
|
||||
|
||||
if isinstance(opt[attr], dict) and '_type' in opt[attr]:
|
||||
if opt[attr]['_type'] == 'literalExpression':
|
||||
if '\n' in opt[attr]['text']:
|
||||
@ -42,6 +44,8 @@ def render_option_value(opt, attr):
|
||||
res = '```{}```'.format(opt[attr]['text'])
|
||||
elif opt[attr]['_type'] == 'literalMD':
|
||||
res = opt[attr]['text']
|
||||
else:
|
||||
assert RuntimeError(f"Unhandled option type {opt[attr]["_type"]}")
|
||||
else:
|
||||
s = str(opt[attr])
|
||||
if s == "":
|
||||
@ -50,10 +54,8 @@ def render_option_value(opt, attr):
|
||||
res = '\n```\n' + s.rstrip('\n') + '\n```'
|
||||
else:
|
||||
res = '```{}```'.format(s)
|
||||
res = '- ' + attr + ': ' + res
|
||||
else:
|
||||
res = ""
|
||||
return res
|
||||
|
||||
return '- ' + attr + ': ' + res # type: ignore
|
||||
|
||||
def print_option(opt):
|
||||
if isinstance(opt['description'], dict) and '_type' in opt['description']: # mdDoc
|
||||
|
Loading…
x
Reference in New Issue
Block a user