[config] adds a __doc__ constructor kwarg to set option documentation inline.
This commit is contained in:
@ -53,13 +53,15 @@ class Option:
|
||||
|
||||
_creation_counter = 0
|
||||
|
||||
def __init__(self, type=None, *, required=True, positional=False, default=None):
|
||||
def __init__(self, type=None, *, required=True, positional=False, default=None, __doc__=None):
|
||||
self.name = None
|
||||
self.type = type
|
||||
self.required = required if default is None else False
|
||||
self.positional = positional
|
||||
self.default = default
|
||||
|
||||
self.__doc__ = __doc__ or self.__doc__
|
||||
|
||||
# This hack is necessary for python3.5
|
||||
self._creation_counter = Option._creation_counter
|
||||
Option._creation_counter += 1
|
||||
|
||||
@ -77,9 +77,13 @@ def _shorten(s, w):
|
||||
|
||||
|
||||
class PrettyPrinter(Configurable):
|
||||
max_width = Option(int, required=False, __doc__='''
|
||||
max_width = Option(
|
||||
int,
|
||||
required=False,
|
||||
__doc__='''
|
||||
If set, truncates the output values longer than this to this width.
|
||||
''')
|
||||
'''
|
||||
)
|
||||
|
||||
def call(self, *args, **kwargs):
|
||||
formater = self._format_quiet if settings.QUIET.get() else self._format_console
|
||||
|
||||
Reference in New Issue
Block a user