Hello community,
here is the log from the commit of package python-click-help-colors for
openSUSE:Factory checked in at 2019-09-27 14:47:19
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-click-help-colors (Old)
and /work/SRC/openSUSE:Factory/.python-click-help-colors.new.2352 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-click-help-colors"
Fri Sep 27 14:47:19 2019 rev:2 rq:730678 version:0.6
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-click-help-colors/python-click-help-colors.changes
2019-08-13 13:25:15.093355431 +0200
+++
/work/SRC/openSUSE:Factory/.python-click-help-colors.new.2352/python-click-help-colors.changes
2019-09-27 14:47:22.248932893 +0200
@@ -1,0 +2,6 @@
+Fri Sep 13 10:59:27 UTC 2019 - Tomáš Chvátal <[email protected]>
+
+- Update to 0.6:
+ * Added feature to set unique colors for each option.
+
+-------------------------------------------------------------------
Old:
----
click-help-colors-0.5.tar.gz
New:
----
click-help-colors-0.6.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-click-help-colors.spec ++++++
--- /var/tmp/diff_new_pack.gilcSo/_old 2019-09-27 14:47:22.840931354 +0200
+++ /var/tmp/diff_new_pack.gilcSo/_new 2019-09-27 14:47:22.848931333 +0200
@@ -18,7 +18,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-click-help-colors
-Version: 0.5
+Version: 0.6
Release: 0
Summary: Colorization of help messages in Click
License: MIT
++++++ click-help-colors-0.5.tar.gz -> click-help-colors-0.6.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/click-help-colors-0.5/PKG-INFO
new/click-help-colors-0.6/PKG-INFO
--- old/click-help-colors-0.5/PKG-INFO 2018-10-01 12:26:04.000000000 +0200
+++ new/click-help-colors-0.6/PKG-INFO 2019-07-19 09:02:53.000000000 +0200
@@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: click-help-colors
-Version: 0.5
+Version: 0.6
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.5.tar.gz
+Download-URL: https://github.com/r-m-n/click-help-colors/archive/0.6.tar.gz
Description: UNKNOWN
Keywords: click
Platform: UNKNOWN
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/click-help-colors-0.5/README.rst
new/click-help-colors-0.6/README.rst
--- old/click-help-colors-0.5/README.rst 2018-10-01 12:03:27.000000000
+0200
+++ new/click-help-colors-0.6/README.rst 2019-07-19 08:59:51.000000000
+0200
@@ -51,6 +51,48 @@
.. image::
https://raw.githubusercontent.com/r-m-n/click-help-colors/master/examples/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/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
+
Installation
------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/click-help-colors-0.5/click_help_colors/__init__.py
new/click-help-colors-0.6/click_help_colors/__init__.py
--- old/click-help-colors-0.5/click_help_colors/__init__.py 2018-10-01
12:03:27.000000000 +0200
+++ new/click-help-colors-0.6/click_help_colors/__init__.py 2019-07-19
08:59:51.000000000 +0200
@@ -12,36 +12,52 @@
class HelpColorsFormatter(click.HelpFormatter):
- def __init__(self, headers_color=None, options_color=None, *args,
**kwargs):
+ 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)
+ 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.options_color), row[1]) for
row in rows]
+ 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,
- *args, **kwargs):
+ 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)
+ 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')
@@ -54,12 +70,16 @@
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)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/click-help-colors-0.5/click_help_colors.egg-info/PKG-INFO
new/click-help-colors-0.6/click_help_colors.egg-info/PKG-INFO
--- old/click-help-colors-0.5/click_help_colors.egg-info/PKG-INFO
2018-10-01 12:26:04.000000000 +0200
+++ new/click-help-colors-0.6/click_help_colors.egg-info/PKG-INFO
2019-07-19 09:02:53.000000000 +0200
@@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: click-help-colors
-Version: 0.5
+Version: 0.6
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.5.tar.gz
+Download-URL: https://github.com/r-m-n/click-help-colors/archive/0.6.tar.gz
Description: UNKNOWN
Keywords: click
Platform: UNKNOWN
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/click-help-colors-0.5/setup.py
new/click-help-colors-0.6/setup.py
--- old/click-help-colors-0.5/setup.py 2018-10-01 12:15:32.000000000 +0200
+++ new/click-help-colors-0.6/setup.py 2019-07-19 08:59:51.000000000 +0200
@@ -3,11 +3,11 @@
setup(
name='click-help-colors',
- version=0.5,
+ version=0.6,
packages=['click_help_colors'],
description='Colorization of help messages in Click',
url='https://github.com/r-m-n/click-help-colors',
-
download_url='https://github.com/r-m-n/click-help-colors/archive/0.5.tar.gz',
+
download_url='https://github.com/r-m-n/click-help-colors/archive/0.6.tar.gz',
keywords=['click'],
license='MIT',
install_requires=[