diff options
author | Armin Ronacher <armin.ronacher@active-4.com> | 2014-06-06 19:33:47 +0600 |
---|---|---|
committer | Armin Ronacher <armin.ronacher@active-4.com> | 2014-06-06 19:33:47 +0600 |
commit | 5bf07ba510a82d546b99518171ec2b365ac05962 (patch) | |
tree | f06d8dda3bc45e0d2eeeaf91038cbce63a7fbf98 | |
parent | d914ad6bb958fc81ad129a18f74d0a3ce74d0fee (diff) | |
download | click-5bf07ba510a82d546b99518171ec2b365ac05962.tar.gz |
Unified help parameter after last pull.
-rw-r--r-- | click/decorators.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/click/decorators.py b/click/decorators.py index 25623f3..4c36c80 100644 --- a/click/decorators.py +++ b/click/decorators.py @@ -76,10 +76,14 @@ def _make_command(f, name, attrs, cls): del f.__click_params__ except AttributeError: params = [] - help = inspect.getdoc(f) - if isinstance(help, bytes): - help = help.decode('utf-8') - attrs.setdefault('help', help) + help = attrs.get('help') + if help is None: + help = inspect.getdoc(f) + if isinstance(help, bytes): + help = help.decode('utf-8') + else: + help = inspect.cleandoc(help) + attrs['help'] = help return cls(name=name or f.__name__.lower(), callback=f, params=params, **attrs) |