Commit 816e5863 authored by John Kirkwood's avatar John Kirkwood

Merge remote-tracking branch 'origin/builtins'

parents 8133ed1e 34e29673
Pipeline #2540 passed with stages
in 34 seconds
......@@ -18,7 +18,7 @@ class GroupDocDescriptor:
if '_doc' in obj.__dict__:
ret.append(obj._doc.strip() + '\n')
width = len(max(obj.keys(), key=len)) + 2
width = len(max(obj.keys(), key=len, default=[''])) + 2
for name, cmd in obj.items():
line = ' ' + ''.join([
cmd.color,
......
......@@ -48,9 +48,14 @@ class DocDescriptor:
ret = []
if callable(obj.target):
# TODO: enhance output of the signature help
sig = ''
try:
sig = inspect.signature(obj.target)
except ValueError:
pass
ret.append(''.join([
f'Signature: {GREEN}{obj.name}{RESET}',
f'{inspect.signature(obj.target)}'
f'{sig}'
]))
if 'value' in self.__dict__:
......
......@@ -16,6 +16,8 @@ import pytest
('run_module_nodoc', 'test_cli2.test_cli2'),
('help_module', 'help cli2'),
('help_module_attr_notfound', 'help cli2.skipppp'),
('help_module_no_callables', 'help datetime'),
('help_module_no_signature', 'help datetime.datetime'),
('docmod', 'docmod cli2'),
('docmod_noargs', 'docmod'),
('docfile', 'docfile cli2/cli.py'),
......
command: cli2 help datetime
retcode: 1
stdout:
Concrete date/time and related types.
See http://www.iana.org/time-zones/repository/tz-link.html for
time zone and DST data sources.
command: cli2 help datetime.datetime
retcode: 1
stdout:
Signature: datetime.datetime
datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])
The year, month and day arguments are required. tzinfo may be None, or an
instance of a tzinfo subclass. The remaining arguments may be ints.
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