mirror of
https://gitlab.com/simple-nixos-mailserver/nixos-mailserver.git
synced 2025-05-17 16:10: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"]
|
"mailserver.borgbackup"]
|
||||||
|
|
||||||
def render_option_value(opt, attr):
|
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 isinstance(opt[attr], dict) and '_type' in opt[attr]:
|
||||||
if opt[attr]['_type'] == 'literalExpression':
|
if opt[attr]['_type'] == 'literalExpression':
|
||||||
if '\n' in opt[attr]['text']:
|
if '\n' in opt[attr]['text']:
|
||||||
@ -42,6 +44,8 @@ def render_option_value(opt, attr):
|
|||||||
res = '```{}```'.format(opt[attr]['text'])
|
res = '```{}```'.format(opt[attr]['text'])
|
||||||
elif opt[attr]['_type'] == 'literalMD':
|
elif opt[attr]['_type'] == 'literalMD':
|
||||||
res = opt[attr]['text']
|
res = opt[attr]['text']
|
||||||
|
else:
|
||||||
|
assert RuntimeError(f"Unhandled option type {opt[attr]["_type"]}")
|
||||||
else:
|
else:
|
||||||
s = str(opt[attr])
|
s = str(opt[attr])
|
||||||
if s == "":
|
if s == "":
|
||||||
@ -50,10 +54,8 @@ def render_option_value(opt, attr):
|
|||||||
res = '\n```\n' + s.rstrip('\n') + '\n```'
|
res = '\n```\n' + s.rstrip('\n') + '\n```'
|
||||||
else:
|
else:
|
||||||
res = '```{}```'.format(s)
|
res = '```{}```'.format(s)
|
||||||
res = '- ' + attr + ': ' + res
|
|
||||||
else:
|
return '- ' + attr + ': ' + res # type: ignore
|
||||||
res = ""
|
|
||||||
return res
|
|
||||||
|
|
||||||
def print_option(opt):
|
def print_option(opt):
|
||||||
if isinstance(opt['description'], dict) and '_type' in opt['description']: # mdDoc
|
if isinstance(opt['description'], dict) and '_type' in opt['description']: # mdDoc
|
||||||
|
Loading…
x
Reference in New Issue
Block a user