Tweak comment indentation in generated configuration file for clarity.

This commit is contained in:
Dan Helfman 2020-06-02 11:37:13 -07:00
parent adda33dc4e
commit 00033bf0a8
3 changed files with 8 additions and 7 deletions

3
NEWS
View File

@ -1,3 +1,6 @@
1.5.6.dev0
* Tweak comment indentation in generated configuration file for clarity.
1.5.5 1.5.5
* #314: Fix regression in support for PostgreSQL's "directory" dump format. Unlike other dump * #314: Fix regression in support for PostgreSQL's "directory" dump format. Unlike other dump
formats, the "directory" dump format does not stream directly to/from Borg. formats, the "directory" dump format does not stream directly to/from Borg.

View File

@ -37,9 +37,7 @@ def _schema_to_sample_configuration(schema, level=0, parent_is_sequence=False):
for item_schema in schema['seq'] for item_schema in schema['seq']
] ]
) )
add_comments_to_configuration_sequence( add_comments_to_configuration_sequence(config, schema, indent=(level * INDENT))
config, schema, indent=(level * INDENT) + SEQUENCE_INDENT
)
elif 'map' in schema: elif 'map' in schema:
config = yaml.comments.CommentedMap( config = yaml.comments.CommentedMap(
[ [
@ -86,8 +84,8 @@ def _comment_out_optional_configuration(rendered_config):
optional = False optional = False
for line in rendered_config.split('\n'): for line in rendered_config.split('\n'):
# Upon encountering an optional configuration option, commenting out lines until the next # Upon encountering an optional configuration option, comment out lines until the next blank
# blank line. # line.
if line.strip().startswith('# {}'.format(COMMENTED_OUT_SENTINEL)): if line.strip().startswith('# {}'.format(COMMENTED_OUT_SENTINEL)):
optional = True optional = True
continue continue
@ -142,7 +140,7 @@ def add_comments_to_configuration_sequence(config, schema, indent=0):
``` ```
things: things:
# First key description. Added by this function. # First key description. Added by this function.
- key: foo - key: foo
# Second key description. Added by add_comments_to_configuration_map(). # Second key description. Added by add_comments_to_configuration_map().
other: bar other: bar

View File

@ -1,6 +1,6 @@
from setuptools import find_packages, setup from setuptools import find_packages, setup
VERSION = '1.5.5' VERSION = '1.5.6.dev0'
setup( setup(