Hello community, here is the log from the commit of package python-click-help-colors for openSUSE:Leap:15.2 checked in at 2020-04-14 14:22:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Leap:15.2/python-click-help-colors (Old) and /work/SRC/openSUSE:Leap:15.2/.python-click-help-colors.new.3248 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-click-help-colors" Tue Apr 14 14:22:08 2020 rev:2 rq:793616 version:0.8 Changes: -------- --- /work/SRC/openSUSE:Leap:15.2/python-click-help-colors/python-click-help-colors.changes 2020-03-27 16:48:14.919937713 +0100 +++ /work/SRC/openSUSE:Leap:15.2/.python-click-help-colors.new.3248/python-click-help-colors.changes 2020-04-14 14:24:00.969410404 +0200 @@ -1,0 +2,8 @@ +Tue Mar 31 12:18:10 UTC 2020 - Marketa Calabkova <mcalabk...@suse.com> + +- Update to 0.8 + * Add support for NO_COLOR <https://no-color.org/> + * Add support for MultiCommands + * Add support for version_option + +------------------------------------------------------------------- Old: ---- click-help-colors-0.6.tar.gz New: ---- click-help-colors-0.8.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-click-help-colors.spec ++++++ --- /var/tmp/diff_new_pack.DHEKvM/_old 2020-04-14 14:24:01.281410637 +0200 +++ /var/tmp/diff_new_pack.DHEKvM/_new 2020-04-14 14:24:01.285410640 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-click-help-colors # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-click-help-colors -Version: 0.6 +Version: 0.8 Release: 0 Summary: Colorization of help messages in Click License: MIT @@ -32,6 +32,7 @@ BuildArch: noarch # SECTION test requirements BuildRequires: %{python_module click >= 7.0} +BuildRequires: %{python_module pytest} # /SECTION %python_subpackages @@ -48,6 +49,9 @@ %python_install %python_expand %fdupes %{buildroot}%{$python_sitelib} +%check +%pytest + %files %{python_files} %doc README.rst %license LICENSE.txt ++++++ click-help-colors-0.6.tar.gz -> click-help-colors-0.8.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-help-colors-0.6/CHANGES.rst new/click-help-colors-0.8/CHANGES.rst --- old/click-help-colors-0.6/CHANGES.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/click-help-colors-0.8/CHANGES.rst 2020-03-13 15:03:35.000000000 +0100 @@ -0,0 +1,9 @@ +[0.8] +------------------------------- +- Add missing files to sdist + +[0.7] +------------------------------- +- Add support for NO_COLOR <https://no-color.org/> +- Add support for MultiCommands +- Add support for version_option diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-help-colors-0.6/MANIFEST.in new/click-help-colors-0.8/MANIFEST.in --- old/click-help-colors-0.6/MANIFEST.in 2019-07-19 08:59:51.000000000 +0200 +++ new/click-help-colors-0.8/MANIFEST.in 2020-03-13 14:52:57.000000000 +0100 @@ -1,2 +1,8 @@ # Include the license file include LICENSE.txt +include CHANGES.rst +include tox.ini +graft tests +graft examples +prune examples/screenshots +global-exclude *.py[cod] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-help-colors-0.6/PKG-INFO new/click-help-colors-0.8/PKG-INFO --- old/click-help-colors-0.6/PKG-INFO 2019-07-19 09:02:53.000000000 +0200 +++ new/click-help-colors-0.8/PKG-INFO 2020-03-13 15:08:10.000000000 +0100 @@ -1,12 +1,176 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: click-help-colors -Version: 0.6 +Version: 0.8 Summary: Colorization of help messages in Click Home-page: https://github.com/r-m-n/click-help-colors -Author: UNKNOWN -Author-email: UNKNOWN License: MIT -Download-URL: https://github.com/r-m-n/click-help-colors/archive/0.6.tar.gz -Description: UNKNOWN +Description: ================= + click-help-colors + ================= + + |build| |pypi| |downloads| + + Colorization of help messages in Click_. + + Usage + ----- + + .. code:: python + + import click + from click_help_colors import HelpColorsGroup, HelpColorsCommand + + @click.group( + cls=HelpColorsGroup, + help_headers_color='yellow', + help_options_color='green' + ) + def cli(): + pass + + @cli.command() + @click.option('--count', default=1, help='Some number.') + def command1(count): + click.echo('command 1') + + @cli.command( + cls=HelpColorsCommand, + help_options_color='blue' + ) + @click.option('--name', help='Some string.') + def command2(name): + click.echo('command 2') + + .. code-block:: console + + $ python example.py --help + + .. image:: https://raw.githubusercontent.com/r-m-n/click-help-colors/master/examples/screenshots/1.png + + .. code-block:: console + + $ python example.py command1 --help + + .. image:: https://raw.githubusercontent.com/r-m-n/click-help-colors/master/examples/screenshots/2.png + + .. code-block:: console + + $ python example.py command2 --help + + .. image:: https://raw.githubusercontent.com/r-m-n/click-help-colors/master/examples/screenshots/3.png + + .. code:: python + + import click + from click_help_colors import HelpColorsGroup, HelpColorsCommand + + @click.group( + cls=HelpColorsGroup, + help_headers_color='yellow', + help_options_color='green', + help_options_custom_colors={'command3': 'red', 'command4': 'cyan'} + ) + def cli(): + pass + + + @cli.command( + cls=HelpColorsCommand, + help_headers_color=None, + help_options_color=None, + help_options_custom_colors={'--count': 'red', '--subtract': 'green'} + ) + @click.option('--count', default=1, help='Count help text.') + @click.option('--add', default=1, help='Add help text.') + @click.option('--subtract', default=1, help='Subtract help text.') + def command1(count, add, subtract): + """A command""" + click.echo('command 1') + + ... + + .. code-block:: console + + $ python example_with_custom_colors.py --help + + .. image:: https://raw.githubusercontent.com/r-m-n/click-help-colors/master/examples/screenshots/4.png + + .. code-block:: console + + $ python example_with_custom_colors.py --help + + .. image:: https://raw.githubusercontent.com/r-m-n/click-help-colors/master/examples/screenshots/5.png + + .. code:: python + + from click_help_colors import version_option + + @click.group() + def cli(): + pass + + @cli.command() + @version_option( + version='1.0', + prog_name='example', + message_color='green' + ) + def cmd1(): + pass + + @cli.command() + @version_option( + version='1.0', + prog_name='example', + version_color='green', + prog_name_color='yellow' + ) + def cmd2(): + pass + + @cli.command() + @version_option( + version='1.0', + prog_name='example', + version_color='green', + prog_name_color='white', + message='%(prog)s %(version)s\n python=3.7', + message_color='bright_black' + ) + def cmd3(): + pass + + .. image:: https://raw.githubusercontent.com/r-m-n/click-help-colors/master/examples/screenshots/6.png + + Installation + ------------ + + With ``pip``: + + .. code-block:: console + + $ pip install click-help-colors + + From source: + + .. code-block:: console + + $ git clone https://github.com/r-m-n/click-help-colors.git + $ cd click-help-colors + $ python setup.py install + + .. _Click: http://click.pocoo.org/ + + + .. |pypi| image:: https://img.shields.io/pypi/v/click-help-colors + :alt: PyPI + + .. |build| image:: https://travis-ci.com/click-contrib/click-help-colors.svg?branch=master + :target: https://travis-ci.com/click-contrib/click-help-colors + + .. |downloads| image:: https://img.shields.io/pypi/dm/click-help-colors + :alt: PyPI - Downloads + Keywords: click Platform: UNKNOWN +Provides-Extra: dev diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-help-colors-0.6/README.rst new/click-help-colors-0.8/README.rst --- old/click-help-colors-0.6/README.rst 2019-07-19 08:59:51.000000000 +0200 +++ new/click-help-colors-0.8/README.rst 2020-02-29 12:45:09.000000000 +0100 @@ -2,6 +2,8 @@ click-help-colors ================= +|build| |pypi| |downloads| + Colorization of help messages in Click_. Usage @@ -37,19 +39,19 @@ $ python example.py --help -.. image:: https://raw.githubusercontent.com/r-m-n/click-help-colors/master/examples/1.png +.. image:: https://raw.githubusercontent.com/r-m-n/click-help-colors/master/examples/screenshots/1.png .. code-block:: console $ python example.py command1 --help -.. image:: https://raw.githubusercontent.com/r-m-n/click-help-colors/master/examples/2.png +.. image:: https://raw.githubusercontent.com/r-m-n/click-help-colors/master/examples/screenshots/2.png .. code-block:: console $ python example.py command2 --help -.. image:: https://raw.githubusercontent.com/r-m-n/click-help-colors/master/examples/3.png +.. image:: https://raw.githubusercontent.com/r-m-n/click-help-colors/master/examples/screenshots/3.png .. code:: python @@ -85,14 +87,55 @@ $ python example_with_custom_colors.py --help -.. image:: https://raw.githubusercontent.com/r-m-n/click-help-colors/master/examples/4.png +.. image:: https://raw.githubusercontent.com/r-m-n/click-help-colors/master/examples/screenshots/4.png .. code-block:: console $ python example_with_custom_colors.py --help -.. image:: https://raw.githubusercontent.com/r-m-n/click-help-colors/master/examples/5.png - +.. image:: https://raw.githubusercontent.com/r-m-n/click-help-colors/master/examples/screenshots/5.png + +.. code:: python + + from click_help_colors import version_option + + @click.group() + def cli(): + pass + + @cli.command() + @version_option( + version='1.0', + prog_name='example', + message_color='green' + ) + def cmd1(): + pass + + @cli.command() + @version_option( + version='1.0', + prog_name='example', + version_color='green', + prog_name_color='yellow' + ) + def cmd2(): + pass + + @cli.command() + @version_option( + version='1.0', + prog_name='example', + version_color='green', + prog_name_color='white', + message='%(prog)s %(version)s\n python=3.7', + message_color='bright_black' + ) + def cmd3(): + pass + +.. image:: https://raw.githubusercontent.com/r-m-n/click-help-colors/master/examples/screenshots/6.png + Installation ------------ @@ -111,3 +154,13 @@ $ python setup.py install .. _Click: http://click.pocoo.org/ + + +.. |pypi| image:: https://img.shields.io/pypi/v/click-help-colors + :alt: PyPI + +.. |build| image:: https://travis-ci.com/click-contrib/click-help-colors.svg?branch=master + :target: https://travis-ci.com/click-contrib/click-help-colors + +.. |downloads| image:: https://img.shields.io/pypi/dm/click-help-colors + :alt: PyPI - Downloads diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-help-colors-0.6/click_help_colors/__init__.py new/click-help-colors-0.8/click_help_colors/__init__.py --- old/click-help-colors-0.6/click_help_colors/__init__.py 2019-07-19 08:59:51.000000000 +0200 +++ new/click-help-colors-0.8/click_help_colors/__init__.py 2020-03-13 14:55:20.000000000 +0100 @@ -1,88 +1,19 @@ -import click -from click.termui import _ansi_colors, _ansi_reset_all +from .core import HelpColorsFormatter, HelpColorsMixin, HelpColorsGroup, \ + HelpColorsCommand, HelpColorsMultiCommand +from .utils import _colorize, HelpColorsException -def _colorize(text, color=None): - if not color: - return text - try: - return '\033[%dm' % (_ansi_colors[color]) + text + _ansi_reset_all - except KeyError: - raise TypeError('Unknown color %r' % color) - - -class HelpColorsFormatter(click.HelpFormatter): - def __init__(self, headers_color=None, options_color=None, - options_custom_colors=None, *args, **kwargs): - self.headers_color = headers_color - self.options_color = options_color - self.options_custom_colors = options_custom_colors - super(HelpColorsFormatter, self).__init__(*args, **kwargs) - - def _pick_color(self, option_name): - opt = option_name.split()[0] - if (self.options_custom_colors and - (opt in self.options_custom_colors.keys())): - return self.options_custom_colors[opt] - else: - return self.options_color - - def write_usage(self, prog, args='', prefix='Usage: '): - colorized_prefix = _colorize(prefix, color=self.headers_color) - super(HelpColorsFormatter, self).write_usage(prog, - args, - prefix=colorized_prefix) - - def write_heading(self, heading): - colorized_heading = _colorize(heading, color=self.headers_color) - super(HelpColorsFormatter, self).write_heading(colorized_heading) - - def write_dl(self, rows, **kwargs): - colorized_rows = [(_colorize(row[0], self._pick_color(row[0])), row[1]) - for row in rows] - super(HelpColorsFormatter, self).write_dl(colorized_rows, **kwargs) - - -class HelpColorsMixin(object): - def __init__(self, help_headers_color=None, help_options_color=None, - help_options_custom_colors=None, *args, **kwargs): - self.help_headers_color = help_headers_color - self.help_options_color = help_options_color - self.help_options_custom_colors = help_options_custom_colors - super(HelpColorsMixin, self).__init__(*args, **kwargs) - - def get_help(self, ctx): - formatter = HelpColorsFormatter( - width=ctx.terminal_width, - max_width=ctx.max_content_width, - headers_color=self.help_headers_color, - options_color=self.help_options_color, - options_custom_colors=self.help_options_custom_colors) - self.format_help(ctx, formatter) - return formatter.getvalue().rstrip('\n') - - -class HelpColorsGroup(HelpColorsMixin, click.Group): - def __init__(self, *args, **kwargs): - super(HelpColorsGroup, self).__init__(*args, **kwargs) - - def command(self, *args, **kwargs): - kwargs.setdefault('cls', HelpColorsCommand) - kwargs.setdefault('help_headers_color', self.help_headers_color) - kwargs.setdefault('help_options_color', self.help_options_color) - kwargs.setdefault('help_options_custom_colors', - self.help_options_custom_colors) - return super(HelpColorsGroup, self).command(*args, **kwargs) - - def group(self, *args, **kwargs): - kwargs.setdefault('cls', HelpColorsGroup) - kwargs.setdefault('help_headers_color', self.help_headers_color) - kwargs.setdefault('help_options_color', self.help_options_color) - kwargs.setdefault('help_options_custom_colors', - self.help_options_custom_colors) - return super(HelpColorsGroup, self).group(*args, **kwargs) - - -class HelpColorsCommand(HelpColorsMixin, click.Command): - def __init__(self, *args, **kwargs): - super(HelpColorsCommand, self).__init__(*args, **kwargs) +from .decorators import version_option + + +__all__ = [ + 'HelpColorsFormatter', 'HelpColorsMixin', 'HelpColorsGroup', + 'HelpColorsCommand', 'HelpColorsMultiCommand', + + '_colorize', 'HelpColorsException', + + 'version_option' +] + + +__version__ = '0.8' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-help-colors-0.6/click_help_colors/core.py new/click-help-colors-0.8/click_help_colors/core.py --- old/click-help-colors-0.6/click_help_colors/core.py 1970-01-01 01:00:00.000000000 +0100 +++ new/click-help-colors-0.8/click_help_colors/core.py 2020-02-29 08:50:17.000000000 +0100 @@ -0,0 +1,103 @@ +import click + +from .utils import _colorize, _extend_instance + + +class HelpColorsFormatter(click.HelpFormatter): + def __init__(self, headers_color=None, options_color=None, + options_custom_colors=None, *args, **kwargs): + self.headers_color = headers_color + self.options_color = options_color + self.options_custom_colors = options_custom_colors + super(HelpColorsFormatter, self).__init__(*args, **kwargs) + + def _pick_color(self, option_name): + opt = option_name.split()[0] + if (self.options_custom_colors and + (opt in self.options_custom_colors.keys())): + return self.options_custom_colors[opt] + else: + return self.options_color + + def write_usage(self, prog, args='', prefix='Usage: '): + colorized_prefix = _colorize(prefix, color=self.headers_color) + super(HelpColorsFormatter, self).write_usage(prog, + args, + prefix=colorized_prefix) + + def write_heading(self, heading): + colorized_heading = _colorize(heading, color=self.headers_color) + super(HelpColorsFormatter, self).write_heading(colorized_heading) + + def write_dl(self, rows, **kwargs): + colorized_rows = [(_colorize(row[0], self._pick_color(row[0])), row[1]) + for row in rows] + super(HelpColorsFormatter, self).write_dl(colorized_rows, **kwargs) + + +class HelpColorsMixin(object): + def __init__(self, help_headers_color=None, help_options_color=None, + help_options_custom_colors=None, *args, **kwargs): + self.help_headers_color = help_headers_color + self.help_options_color = help_options_color + self.help_options_custom_colors = help_options_custom_colors + super(HelpColorsMixin, self).__init__(*args, **kwargs) + + def get_help(self, ctx): + formatter = HelpColorsFormatter( + width=ctx.terminal_width, + max_width=ctx.max_content_width, + headers_color=self.help_headers_color, + options_color=self.help_options_color, + options_custom_colors=self.help_options_custom_colors) + self.format_help(ctx, formatter) + return formatter.getvalue().rstrip('\n') + + +class HelpColorsGroup(HelpColorsMixin, click.Group): + def __init__(self, *args, **kwargs): + super(HelpColorsGroup, self).__init__(*args, **kwargs) + + def command(self, *args, **kwargs): + kwargs.setdefault('cls', HelpColorsCommand) + kwargs.setdefault('help_headers_color', self.help_headers_color) + kwargs.setdefault('help_options_color', self.help_options_color) + kwargs.setdefault('help_options_custom_colors', + self.help_options_custom_colors) + return super(HelpColorsGroup, self).command(*args, **kwargs) + + def group(self, *args, **kwargs): + kwargs.setdefault('cls', HelpColorsGroup) + kwargs.setdefault('help_headers_color', self.help_headers_color) + kwargs.setdefault('help_options_color', self.help_options_color) + kwargs.setdefault('help_options_custom_colors', + self.help_options_custom_colors) + return super(HelpColorsGroup, self).group(*args, **kwargs) + + +class HelpColorsCommand(HelpColorsMixin, click.Command): + def __init__(self, *args, **kwargs): + super(HelpColorsCommand, self).__init__(*args, **kwargs) + + +class HelpColorsMultiCommand(HelpColorsMixin, click.MultiCommand): + def __init__(self, *args, **kwargs): + super(HelpColorsMultiCommand, self).__init__(*args, **kwargs) + + def resolve_command(self, ctx, args): + cmd_name, cmd, args[1:] = super(HelpColorsMultiCommand, self).resolve_command(ctx, args) + + if not isinstance(cmd, HelpColorsMixin): + if isinstance(cmd, click.Group): + _extend_instance(cmd, HelpColorsGroup) + if isinstance(cmd, click.Command): + _extend_instance(cmd, HelpColorsCommand) + + if not getattr(cmd, 'help_headers_color', None): + cmd.help_headers_color = self.help_headers_color + if not getattr(cmd, 'help_options_color', None): + cmd.help_options_color = self.help_options_color + if not getattr(cmd, 'help_options_custom_colors', None): + cmd.help_options_custom_colors = self.help_options_custom_colors + + return cmd_name, cmd, args[1:] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-help-colors-0.6/click_help_colors/decorators.py new/click-help-colors-0.8/click_help_colors/decorators.py --- old/click-help-colors-0.6/click_help_colors/decorators.py 1970-01-01 01:00:00.000000000 +0100 +++ new/click-help-colors-0.8/click_help_colors/decorators.py 2020-02-29 10:47:05.000000000 +0100 @@ -0,0 +1,79 @@ +import sys +import re + +from click import echo +from click.decorators import option +from click._compat import iteritems + +from .utils import _colorize + + +def version_option(version=None, *param_decls, **attrs): + """Adds a ``--version`` option which immediately ends the program + printing out the version number. This is implemented as an eager + option that prints the version and exits the program in the callback. + + :param version: the version number to show. If not provided Click + attempts an auto discovery via setuptools. + :param prog_name: the name of the program (defaults to autodetection) + :param message: custom message to show instead of the default + (``'%(prog)s, version %(version)s'``) + :param prog_name_color: color of the prog_name + :param version_color: color of the version + :param message_color: default color of the message + :param others: everything else is forwarded to :func:`option`. + """ + if version is None: + if hasattr(sys, '_getframe'): + module = sys._getframe(1).f_globals.get('__name__') + else: + module = '' + + def decorator(f): + prog_name = attrs.pop('prog_name', None) + message = attrs.pop('message', '%(prog)s, version %(version)s') + message_color = attrs.pop('message_color', None) + prog_name_color = attrs.pop('prog_name_color', message_color) + version_color = attrs.pop('version_color', message_color) + + def callback(ctx, param, value): + if not value or ctx.resilient_parsing: + return + prog = prog_name + if prog is None: + prog = ctx.find_root().info_name + ver = version + if ver is None: + try: + import pkg_resources + except ImportError: + pass + else: + for dist in pkg_resources.working_set: + scripts = dist.get_entry_map().get('console_scripts') or {} + for script_name, entry_point in iteritems(scripts): + if entry_point.module_name == module: + ver = dist.version + break + if ver is None: + raise RuntimeError('Could not determine version') + + msg_parts = [] + for s in re.split(r'(%\(version\)s|%\(prog\)s)', message): + if s == '%(prog)s': + msg_parts.append(_colorize(prog_name, prog_name_color)) + elif s == '%(version)s': + msg_parts.append(_colorize(version, version_color)) + else: + msg_parts.append(_colorize(s, message_color)) + + echo(''.join(msg_parts)) + ctx.exit() + + attrs.setdefault('is_flag', True) + attrs.setdefault('expose_value', False) + attrs.setdefault('is_eager', True) + attrs.setdefault('help', 'Show the version and exit.') + attrs['callback'] = callback + return option(*(param_decls or ('--version',)), **attrs)(f) + return decorator diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-help-colors-0.6/click_help_colors/utils.py new/click-help-colors-0.8/click_help_colors/utils.py --- old/click-help-colors-0.6/click_help_colors/utils.py 1970-01-01 01:00:00.000000000 +0100 +++ new/click-help-colors-0.8/click_help_colors/utils.py 2020-02-24 20:50:26.000000000 +0100 @@ -0,0 +1,23 @@ +import os + +from click.termui import _ansi_colors, _ansi_reset_all + + +class HelpColorsException(Exception): + pass + + +def _colorize(text, color=None): + if not color or "NO_COLOR" in os.environ: + return text + try: + return '\033[%dm' % (_ansi_colors[color]) + text + _ansi_reset_all + except KeyError: + raise HelpColorsException('Unknown color %r' % color) + + +def _extend_instance(obj, cls): + """Apply mixin to a class instance after creation""" + base_cls = obj.__class__ + base_cls_name = obj.__class__.__name__ + obj.__class__ = type(base_cls_name, (cls, base_cls), {}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-help-colors-0.6/click_help_colors.egg-info/PKG-INFO new/click-help-colors-0.8/click_help_colors.egg-info/PKG-INFO --- old/click-help-colors-0.6/click_help_colors.egg-info/PKG-INFO 2019-07-19 09:02:53.000000000 +0200 +++ new/click-help-colors-0.8/click_help_colors.egg-info/PKG-INFO 2020-03-13 15:08:10.000000000 +0100 @@ -1,12 +1,176 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: click-help-colors -Version: 0.6 +Version: 0.8 Summary: Colorization of help messages in Click Home-page: https://github.com/r-m-n/click-help-colors -Author: UNKNOWN -Author-email: UNKNOWN License: MIT -Download-URL: https://github.com/r-m-n/click-help-colors/archive/0.6.tar.gz -Description: UNKNOWN +Description: ================= + click-help-colors + ================= + + |build| |pypi| |downloads| + + Colorization of help messages in Click_. + + Usage + ----- + + .. code:: python + + import click + from click_help_colors import HelpColorsGroup, HelpColorsCommand + + @click.group( + cls=HelpColorsGroup, + help_headers_color='yellow', + help_options_color='green' + ) + def cli(): + pass + + @cli.command() + @click.option('--count', default=1, help='Some number.') + def command1(count): + click.echo('command 1') + + @cli.command( + cls=HelpColorsCommand, + help_options_color='blue' + ) + @click.option('--name', help='Some string.') + def command2(name): + click.echo('command 2') + + .. code-block:: console + + $ python example.py --help + + .. image:: https://raw.githubusercontent.com/r-m-n/click-help-colors/master/examples/screenshots/1.png + + .. code-block:: console + + $ python example.py command1 --help + + .. image:: https://raw.githubusercontent.com/r-m-n/click-help-colors/master/examples/screenshots/2.png + + .. code-block:: console + + $ python example.py command2 --help + + .. image:: https://raw.githubusercontent.com/r-m-n/click-help-colors/master/examples/screenshots/3.png + + .. code:: python + + import click + from click_help_colors import HelpColorsGroup, HelpColorsCommand + + @click.group( + cls=HelpColorsGroup, + help_headers_color='yellow', + help_options_color='green', + help_options_custom_colors={'command3': 'red', 'command4': 'cyan'} + ) + def cli(): + pass + + + @cli.command( + cls=HelpColorsCommand, + help_headers_color=None, + help_options_color=None, + help_options_custom_colors={'--count': 'red', '--subtract': 'green'} + ) + @click.option('--count', default=1, help='Count help text.') + @click.option('--add', default=1, help='Add help text.') + @click.option('--subtract', default=1, help='Subtract help text.') + def command1(count, add, subtract): + """A command""" + click.echo('command 1') + + ... + + .. code-block:: console + + $ python example_with_custom_colors.py --help + + .. image:: https://raw.githubusercontent.com/r-m-n/click-help-colors/master/examples/screenshots/4.png + + .. code-block:: console + + $ python example_with_custom_colors.py --help + + .. image:: https://raw.githubusercontent.com/r-m-n/click-help-colors/master/examples/screenshots/5.png + + .. code:: python + + from click_help_colors import version_option + + @click.group() + def cli(): + pass + + @cli.command() + @version_option( + version='1.0', + prog_name='example', + message_color='green' + ) + def cmd1(): + pass + + @cli.command() + @version_option( + version='1.0', + prog_name='example', + version_color='green', + prog_name_color='yellow' + ) + def cmd2(): + pass + + @cli.command() + @version_option( + version='1.0', + prog_name='example', + version_color='green', + prog_name_color='white', + message='%(prog)s %(version)s\n python=3.7', + message_color='bright_black' + ) + def cmd3(): + pass + + .. image:: https://raw.githubusercontent.com/r-m-n/click-help-colors/master/examples/screenshots/6.png + + Installation + ------------ + + With ``pip``: + + .. code-block:: console + + $ pip install click-help-colors + + From source: + + .. code-block:: console + + $ git clone https://github.com/r-m-n/click-help-colors.git + $ cd click-help-colors + $ python setup.py install + + .. _Click: http://click.pocoo.org/ + + + .. |pypi| image:: https://img.shields.io/pypi/v/click-help-colors + :alt: PyPI + + .. |build| image:: https://travis-ci.com/click-contrib/click-help-colors.svg?branch=master + :target: https://travis-ci.com/click-contrib/click-help-colors + + .. |downloads| image:: https://img.shields.io/pypi/dm/click-help-colors + :alt: PyPI - Downloads + Keywords: click Platform: UNKNOWN +Provides-Extra: dev diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-help-colors-0.6/click_help_colors.egg-info/SOURCES.txt new/click-help-colors-0.8/click_help_colors.egg-info/SOURCES.txt --- old/click-help-colors-0.6/click_help_colors.egg-info/SOURCES.txt 2019-07-19 09:02:53.000000000 +0200 +++ new/click-help-colors-0.8/click_help_colors.egg-info/SOURCES.txt 2020-03-13 15:08:10.000000000 +0100 @@ -1,10 +1,25 @@ +CHANGES.rst LICENSE.txt MANIFEST.in README.rst setup.py +tox.ini click_help_colors/__init__.py +click_help_colors/core.py +click_help_colors/decorators.py +click_help_colors/utils.py click_help_colors.egg-info/PKG-INFO click_help_colors.egg-info/SOURCES.txt click_help_colors.egg-info/dependency_links.txt click_help_colors.egg-info/requires.txt -click_help_colors.egg-info/top_level.txt \ No newline at end of file +click_help_colors.egg-info/top_level.txt +examples/example.py +examples/example_with_custom_colors.py +examples/multi_commands.py +examples/version_option.py +tests/__init__.py +tests/conftest.py +tests/test_basic.py +tests/test_custom_colors.py +tests/test_multi_commands.py +tests/test_version_option.py \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-help-colors-0.6/click_help_colors.egg-info/requires.txt new/click-help-colors-0.8/click_help_colors.egg-info/requires.txt --- old/click-help-colors-0.6/click_help_colors.egg-info/requires.txt 2019-07-19 09:02:53.000000000 +0200 +++ new/click-help-colors-0.8/click_help_colors.egg-info/requires.txt 2020-03-13 15:08:10.000000000 +0100 @@ -1 +1,4 @@ click>=7.0 + +[dev] +pytest diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-help-colors-0.6/examples/example.py new/click-help-colors-0.8/examples/example.py --- old/click-help-colors-0.6/examples/example.py 1970-01-01 01:00:00.000000000 +0100 +++ new/click-help-colors-0.8/examples/example.py 2020-02-29 11:29:22.000000000 +0100 @@ -0,0 +1,28 @@ +import click +from click_help_colors import HelpColorsGroup, HelpColorsCommand + + +@click.group( + cls=HelpColorsGroup, + help_headers_color='yellow', + help_options_color='green' +) +def cli(): + pass + +@cli.command() +@click.option('--count', default=1, help='Some number.') +def command1(count): + click.echo('command 1') + +@cli.command( + cls=HelpColorsCommand, + help_options_color='blue' +) +@click.option('--name', help='Some string.') +def command2(name): + click.echo('command 2') + + +if __name__ == '__main__': + cli() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-help-colors-0.6/examples/example_with_custom_colors.py new/click-help-colors-0.8/examples/example_with_custom_colors.py --- old/click-help-colors-0.6/examples/example_with_custom_colors.py 1970-01-01 01:00:00.000000000 +0100 +++ new/click-help-colors-0.8/examples/example_with_custom_colors.py 2020-02-09 14:28:54.000000000 +0100 @@ -0,0 +1,51 @@ +import click +from click_help_colors import HelpColorsGroup, HelpColorsCommand + + +@click.group( + cls=HelpColorsGroup, + help_headers_color='yellow', + help_options_color='green', + help_options_custom_colors={'command3': 'red', 'command4': 'cyan'} +) +def cli(): + pass + + +@cli.command( + cls=HelpColorsCommand, + help_headers_color=None, + help_options_color=None, + help_options_custom_colors={'--count': 'red', '--subtract': 'green'} +) +@click.option('--count', default=1, help='Count help text.') +@click.option('--add', default=1, help='Add help text.') +@click.option('--subtract', default=1, help='Subtract help text.') +def command1(count, add, subtract): + """A command""" + click.echo('command 1') + + +@cli.command() +@click.option('--name', help='Some string.') +def command2(name): + """Another command""" + click.echo('command 2') + + +@cli.command() +@click.option('--name', help='Some string.') +def command3(name): + """Yet another command""" + click.echo('command 3') + + +@cli.command() +@click.option('--name', help='Some string.') +def command4(name): + """One last command""" + click.echo('command 4') + + +if __name__ == '__main__': + cli() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-help-colors-0.6/examples/multi_commands.py new/click-help-colors-0.8/examples/multi_commands.py --- old/click-help-colors-0.6/examples/multi_commands.py 1970-01-01 01:00:00.000000000 +0100 +++ new/click-help-colors-0.8/examples/multi_commands.py 2020-02-24 16:44:02.000000000 +0100 @@ -0,0 +1,49 @@ +import click +from click_help_colors import HelpColorsGroup, HelpColorsMultiCommand + + +@click.group() +def cmd1(): + pass + + +@cmd1.command() +@click.option('--count', default=1, help='Some number.') +def command1(count): + click.echo('command 1') + + +@click.group( + cls=HelpColorsGroup, + help_headers_color='red', + help_options_color='blue' +) +def cmd2(): + pass + + +@cmd2.command() +@click.option('--name', help='Some string.') +def command2(name): + click.echo('command 2') + + +class MyCLI(HelpColorsMultiCommand): + def list_commands(self, ctx): + return ['cmd1', 'cmd2'] + + def get_command(self, ctx, name): + return globals()[name] + + +@click.command( + cls=MyCLI, + help_headers_color='yellow', + help_options_color='green' +) +def cli(): + pass + + +if __name__ == '__main__': + cli() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-help-colors-0.6/examples/version_option.py new/click-help-colors-0.8/examples/version_option.py --- old/click-help-colors-0.6/examples/version_option.py 1970-01-01 01:00:00.000000000 +0100 +++ new/click-help-colors-0.8/examples/version_option.py 2020-02-29 12:45:40.000000000 +0100 @@ -0,0 +1,42 @@ +import click +from click_help_colors import version_option + + +@click.group() +def cli(): + pass + +@cli.command() +@version_option( + version='1.0', + prog_name='example', + message_color='green' +) +def cmd1(): + pass + +@cli.command() +@version_option( + version='1.0', + prog_name='example', + version_color='green', + prog_name_color='yellow' +) +def cmd2(): + pass + +@cli.command() +@version_option( + version='1.0', + prog_name='example', + version_color='green', + prog_name_color='white', + message='%(prog)s %(version)s\n python=3.7', + message_color='bright_black' +) +def cmd3(): + pass + + +if __name__ == '__main__': + cli() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-help-colors-0.6/setup.py new/click-help-colors-0.8/setup.py --- old/click-help-colors-0.6/setup.py 2019-07-19 08:59:51.000000000 +0200 +++ new/click-help-colors-0.8/setup.py 2020-03-13 13:50:41.000000000 +0100 @@ -1,16 +1,32 @@ # -*- coding: utf-8 -*- +import io +import re from setuptools import setup + +with io.open("README.rst", "rt", encoding="utf8") as f: + readme = f.read() + + +with io.open("click_help_colors/__init__.py", "rt", encoding="utf8") as f: + version = re.search(r"__version__ = '(.*?)'", f.read()).group(1) + + setup( name='click-help-colors', - version=0.6, + version=version, packages=['click_help_colors'], description='Colorization of help messages in Click', + long_description=readme, url='https://github.com/r-m-n/click-help-colors', - download_url='https://github.com/r-m-n/click-help-colors/archive/0.6.tar.gz', keywords=['click'], license='MIT', install_requires=[ 'click>=7.0' - ] + ], + extras_require={ + "dev": [ + "pytest", + ] + } ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-help-colors-0.6/tests/conftest.py new/click-help-colors-0.8/tests/conftest.py --- old/click-help-colors-0.6/tests/conftest.py 1970-01-01 01:00:00.000000000 +0100 +++ new/click-help-colors-0.8/tests/conftest.py 2020-02-09 14:28:54.000000000 +0100 @@ -0,0 +1,9 @@ +import pytest + +import click +from click.testing import CliRunner + + +@pytest.fixture +def runner(): + return CliRunner() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-help-colors-0.6/tests/test_basic.py new/click-help-colors-0.8/tests/test_basic.py --- old/click-help-colors-0.6/tests/test_basic.py 1970-01-01 01:00:00.000000000 +0100 +++ new/click-help-colors-0.8/tests/test_basic.py 2020-02-09 16:47:49.000000000 +0100 @@ -0,0 +1,98 @@ +import click +import pytest + +from click_help_colors import HelpColorsGroup, HelpColorsException + + +def test_basic_group(runner): + @click.command( + cls=HelpColorsGroup, + help_headers_color='yellow', + help_options_color='green' + ) + @click.option('--name', help='The person to greet.') + def cli(count): + pass + + result = runner.invoke(cli, ['--help'], color=True) + assert not result.exception + assert result.output.splitlines() == [ + '\x1b[33mUsage: \x1b[0mcli [OPTIONS] COMMAND [ARGS]...', + '', + '\x1b[33mOptions\x1b[0m:', + ' \x1b[32m--name TEXT\x1b[0m The person to greet.', + ' \x1b[32m--help\x1b[0m Show this message and exit.' + ] + + +def test_basic_command(runner): + @click.group( + cls=HelpColorsGroup, + help_headers_color='yellow', + help_options_color='green' + ) + def cli(): + pass + + @cli.command() + @click.option('--name', help='The person to greet.') + def command(name): + pass + + result = runner.invoke(cli, ['--help'], color=True) + assert not result.exception + assert result.output.splitlines() == [ + '\x1b[33mUsage: \x1b[0mcli [OPTIONS] COMMAND [ARGS]...', + '', + '\x1b[33mOptions\x1b[0m:', + ' \x1b[32m--help\x1b[0m Show this message and exit.', + '', + '\x1b[33mCommands\x1b[0m:', + ' \x1b[32mcommand\x1b[0m' + ] + + result = runner.invoke(cli, ['command', '--help'], color=True) + assert not result.exception + assert result.output.splitlines() == [ + '\x1b[33mUsage: \x1b[0mcli command [OPTIONS]', + '', + '\x1b[33mOptions\x1b[0m:', + ' \x1b[32m--name TEXT\x1b[0m The person to greet.', + ' \x1b[32m--help\x1b[0m Show this message and exit.' + ] + + +def test_unknown_color(runner): + @click.command( + cls=HelpColorsGroup, + help_headers_color='unknwnclr' + ) + @click.option('--name', help='The person to greet.') + def cli(count): + pass + + result = runner.invoke(cli, ['--help'], color=True) + assert result.exception + assert isinstance(result.exception, HelpColorsException) + assert str(result.exception) == "Unknown color 'unknwnclr'" + + +def test_env_no_color(runner): + @click.command( + cls=HelpColorsGroup, + help_headers_color='yellow', + help_options_color='green' + ) + @click.option('--name', help='The person to greet.') + def cli(count): + pass + + result = runner.invoke(cli, ['--help'], color=True, env={'NO_COLOR': '1'}) + assert not result.exception + assert result.output.splitlines() == [ + 'Usage: cli [OPTIONS] COMMAND [ARGS]...', + '', + 'Options:', + ' --name TEXT The person to greet.', + ' --help Show this message and exit.' + ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-help-colors-0.6/tests/test_custom_colors.py new/click-help-colors-0.8/tests/test_custom_colors.py --- old/click-help-colors-0.6/tests/test_custom_colors.py 1970-01-01 01:00:00.000000000 +0100 +++ new/click-help-colors-0.8/tests/test_custom_colors.py 2020-02-09 14:28:54.000000000 +0100 @@ -0,0 +1,64 @@ +import click + +from click_help_colors import HelpColorsGroup, HelpColorsCommand + + +def test_command_custom_colors(runner): + @click.group( + cls=HelpColorsGroup, + help_headers_color='yellow', + help_options_color='green' + ) + def cli(): + pass + + @cli.command( + cls=HelpColorsCommand, + help_headers_color='red', + help_options_color='blue' + ) + @click.option('--name', help='The person to greet.') + def command(name): + pass + + result = runner.invoke(cli, ['command', '--help'], color=True) + assert not result.exception + assert result.output.splitlines() == [ + '\x1b[31mUsage: \x1b[0mcli command [OPTIONS]', + '', + '\x1b[31mOptions\x1b[0m:', + ' \x1b[34m--name TEXT\x1b[0m The person to greet.', + ' \x1b[34m--help\x1b[0m Show this message and exit.' + ] + + +def test_custom_option_color(runner): + @click.group( + cls=HelpColorsGroup, + help_headers_color='yellow', + help_options_color='green', + help_options_custom_colors={'command1': 'red'} + ) + def cli(): + pass + + @cli.command() + def command1(name): + pass + + @cli.command() + def command2(name): + pass + + result = runner.invoke(cli, ['--help'], color=True) + assert not result.exception + assert result.output.splitlines() == [ + '\x1b[33mUsage: \x1b[0mcli [OPTIONS] COMMAND [ARGS]...', + '', + '\x1b[33mOptions\x1b[0m:', + ' \x1b[32m--help\x1b[0m Show this message and exit.', + '', + '\x1b[33mCommands\x1b[0m:', + ' \x1b[31mcommand1\x1b[0m', + ' \x1b[32mcommand2\x1b[0m' + ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-help-colors-0.6/tests/test_multi_commands.py new/click-help-colors-0.8/tests/test_multi_commands.py --- old/click-help-colors-0.6/tests/test_multi_commands.py 1970-01-01 01:00:00.000000000 +0100 +++ new/click-help-colors-0.8/tests/test_multi_commands.py 2020-02-24 17:28:21.000000000 +0100 @@ -0,0 +1,84 @@ +import click +import pytest + +from click_help_colors import HelpColorsMultiCommand, HelpColorsGroup + + +def test_multi_command(runner): + @click.group() + def cmd1(): + pass + + @cmd1.command() + @click.option('--count', default=1, help='Some number.') + def command1(count): + click.echo('command 1') + + @click.group( + cls=HelpColorsGroup, + help_headers_color='red', + help_options_color='blue' + ) + def cmd2(): + pass + + @cmd2.command() + @click.option('--name', help='Some string.') + def command2(name): + click.echo('command 2') + + class MyCLI(HelpColorsMultiCommand): + def list_commands(self, ctx): + return ['cmd1', 'cmd2'] + + def get_command(self, ctx, name): + commands = { + 'cmd1': cmd1, + 'cmd2': cmd2 + } + return commands[name] + + @click.command( + cls=MyCLI, + help_headers_color='yellow', + help_options_color='green' + ) + def cli(): + pass + + result = runner.invoke(cli, ['--help'], color=True) + assert not result.exception + assert result.output.splitlines() == [ + '\x1b[33mUsage: \x1b[0mcli [OPTIONS] COMMAND [ARGS]...', + '', + '\x1b[33mOptions\x1b[0m:', + ' \x1b[32m--help\x1b[0m Show this message and exit.', + '', + '\x1b[33mCommands\x1b[0m:', + ' \x1b[32mcmd1\x1b[0m', + ' \x1b[32mcmd2\x1b[0m' + ] + + result = runner.invoke(cli, ['cmd1', '--help'], color=True) + assert not result.exception + assert result.output.splitlines() == [ + '\x1b[33mUsage: \x1b[0mcli cmd1 [OPTIONS] COMMAND [ARGS]...', + '', + '\x1b[33mOptions\x1b[0m:', + ' \x1b[32m--help\x1b[0m Show this message and exit.', + '', + '\x1b[33mCommands\x1b[0m:', + ' \x1b[32mcommand1\x1b[0m' + ] + + result = runner.invoke(cli, ['cmd2', '--help'], color=True) + assert not result.exception + assert result.output.splitlines() == [ + '\x1b[31mUsage: \x1b[0mcli cmd2 [OPTIONS] COMMAND [ARGS]...', + '', + '\x1b[31mOptions\x1b[0m:', + ' \x1b[34m--help\x1b[0m Show this message and exit.', + '', + '\x1b[31mCommands\x1b[0m:', + ' \x1b[34mcommand2\x1b[0m' + ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-help-colors-0.6/tests/test_version_option.py new/click-help-colors-0.8/tests/test_version_option.py --- old/click-help-colors-0.6/tests/test_version_option.py 1970-01-01 01:00:00.000000000 +0100 +++ new/click-help-colors-0.8/tests/test_version_option.py 2020-02-29 11:27:38.000000000 +0100 @@ -0,0 +1,59 @@ +import click + +from click_help_colors import version_option + + +def test_message_color(runner): + @click.group() + @version_option( + version='1.0', + prog_name='example', + message_color='green' + ) + def cli(): + pass + + result = runner.invoke(cli, ['--version'], color=True) + assert not result.exception + assert result.output.splitlines() == [ + '\x1b[32m\x1b[0m\x1b[32mexample\x1b[0m\x1b[32m, version \x1b[0m\x1b[32m1.0\x1b[0m\x1b[32m\x1b[0m' + ] + + +def test_version_and_prog_name_color(runner): + @click.group() + @version_option( + version='1.0', + prog_name='example', + version_color='green', + prog_name_color='yellow' + ) + def cli(): + pass + + result = runner.invoke(cli, ['--version'], color=True) + assert not result.exception + assert result.output.splitlines() == [ + '\x1b[33mexample\x1b[0m, version \x1b[32m1.0\x1b[0m' + ] + + +def test_custom_message(runner): + @click.group() + @version_option( + version='1.0', + prog_name='example', + version_color='green', + prog_name_color='white', + message='%(prog)s %(version)s\n python=3.7', + message_color='bright_black' + ) + def cli(): + pass + + result = runner.invoke(cli, ['--version'], color=True) + assert not result.exception + assert result.output.splitlines() == [ + '\x1b[90m\x1b[0m\x1b[37mexample\x1b[0m\x1b[90m \x1b[0m\x1b[32m1.0\x1b[0m\x1b[90m', + ' python=3.7\x1b[0m' + ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-help-colors-0.6/tox.ini new/click-help-colors-0.8/tox.ini --- old/click-help-colors-0.6/tox.ini 1970-01-01 01:00:00.000000000 +0100 +++ new/click-help-colors-0.8/tox.ini 2020-02-09 14:28:54.000000000 +0100 @@ -0,0 +1,7 @@ +[tox] +envlist = py27,py37 + +[testenv] +deps = pytest +commands = + pytest