Commit 0df253e2 authored by Godefroid Chapelle's avatar Godefroid Chapelle

allow more sections

avoid --section flag
parent 385955ac
...@@ -218,14 +218,14 @@ def _annotate(data, note): ...@@ -218,14 +218,14 @@ def _annotate(data, note):
return data return data
def _print_annotate(data, verbose, chosen_section, basedir): def _print_annotate(data, verbose, chosen_sections, basedir):
sections = list(data.keys()) sections = list(data.keys())
sections.sort() sections.sort()
print_() print_()
print_("Annotated sections") print_("Annotated sections")
print_("="*len("Annotated sections")) print_("="*len("Annotated sections"))
for section in sections: for section in sections:
if (not chosen_section) or (section == chosen_section): if (not chosen_sections) or (section in chosen_sections):
print_() print_()
print_('[%s]' % section) print_('[%s]' % section)
keys = list(data[section].keys()) keys = list(data[section].keys())
...@@ -1236,11 +1236,11 @@ class Buildout(DictMixin): ...@@ -1236,11 +1236,11 @@ class Buildout(DictMixin):
def annotate(self, args=None): def annotate(self, args=None):
verbose = self['buildout'].get('verbosity', 0) <> 0 verbose = self['buildout'].get('verbosity', 0) <> 0
section = None section = None
if args: if args is None:
for arg in args: sections = []
if arg.startswith('--section'): else:
_, section = arg.split("=") sections = args
_print_annotate(self._annotated, verbose, section, self._buildout_dir) _print_annotate(self._annotated, verbose, sections, self._buildout_dir)
def print_options(self, base_path=None): def print_options(self, base_path=None):
for section in sorted(self._data): for section in sorted(self._data):
......
...@@ -1018,9 +1018,9 @@ You get more information about the way values are computed:: ...@@ -1018,9 +1018,9 @@ You get more information about the way values are computed::
... ...
The output of the ``annotate`` command can be very long. The output of the ``annotate`` command can be very long.
You can restrict output to a single section with the ``--section`` flag:: You can restrict the output to some sections by passing section names as arguments::
>>> print_(system(buildout+ ' annotate --section=versions'), end='') >>> print_(system(buildout+ ' annotate versions'), end='')
... # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE ... # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
<BLANKLINE> <BLANKLINE>
Annotated sections Annotated sections
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment