Improve config output
This commit is contained in:
parent
277f4d841d
commit
301f952ccb
@ -73,7 +73,11 @@ class NewConfig:
|
|||||||
option_wrapper = textwrap.TextWrapper(
|
option_wrapper = textwrap.TextWrapper(
|
||||||
width=72, replace_whitespace=False, break_long_words=False,
|
width=72, replace_whitespace=False, break_long_words=False,
|
||||||
break_on_hyphens=False, initial_indent='# ',
|
break_on_hyphens=False, initial_indent='# ',
|
||||||
subsequent_indent='# ')
|
subsequent_indent='#' + ' ' * 5)
|
||||||
|
keyval_wrapper = textwrap.TextWrapper(
|
||||||
|
width=72, replace_whitespace=False, break_long_words=False,
|
||||||
|
break_on_hyphens=False, initial_indent='',
|
||||||
|
subsequent_indent=' ' * 4)
|
||||||
lines = []
|
lines = []
|
||||||
for par in map(normal_wrapper.wrap,
|
for par in map(normal_wrapper.wrap,
|
||||||
configdata.FIRST_COMMENT.splitlines()):
|
configdata.FIRST_COMMENT.splitlines()):
|
||||||
@ -99,7 +103,11 @@ class NewConfig:
|
|||||||
else:
|
else:
|
||||||
wrapped_desc += option_wrapper.wrap(descline)
|
wrapped_desc += option_wrapper.wrap(descline)
|
||||||
lines.append('\n'.join(wrapped_desc))
|
lines.append('\n'.join(wrapped_desc))
|
||||||
lines.append('{} = {}'.format(optname, option))
|
keyval = '{} = {}'.format(optname, option)
|
||||||
|
if 'http://' in keyval:
|
||||||
|
lines.append(keyval)
|
||||||
|
else:
|
||||||
|
lines += keyval_wrapper.wrap(keyval)
|
||||||
return '\n'.join(lines)
|
return '\n'.join(lines)
|
||||||
|
|
||||||
def get(self, section, option, fallback=_UNSET):
|
def get(self, section, option, fallback=_UNSET):
|
||||||
|
Loading…
Reference in New Issue
Block a user