30 return command.lower()
in [
'list',
'show',
'version']
34 if not cls.
handleshandles(command):
35 raise DataError(
"Unknown command '%s'." % command)
36 if command.lower() ==
'version' and args:
37 raise DataError(
"Command 'version' does not take arguments.")
39 def view(self, command, *args):
41 getattr(self, command.lower())(*args)
44 for kw
in self.
_keywords_keywords.search(
'*%s*' % p
for p
in patterns):
48 if MultiMatcher(names, match_if_no_patterns=
True).match(
'intro'):
52 for kw
in self.
_keywords_keywords.search(names):
62 self.
_header_header(lib.name, underline=
'=')
63 named_args =
'supported' if lib.named_args
else 'not supported'
64 self.
_data_data([(
'Version', lib.version), (
'Scope', lib.scope),
65 (
'Named arguments', named_args)])
66 self.
_doc_doc(lib.doc)
69 self.
_header_header(
'Importing', underline=
'-')
70 for init
in lib.inits:
75 self.
_header_header(kw.name, underline=
'-')
76 self.
_data_data([(
'Arguments',
'[%s]' %
', '.join(kw.args))])
80 self.
_console_console(
'%s\n%s' % (name, underline * len(name)))
83 ljust = max(len(name)
for name, _
in items) + 3
84 for name, value
in items:
86 text =
'%s%s' % ((name+
':').ljust(ljust), value)
87 self.
_console_console(self.
_wrap_wrap(text, subsequent_indent=
' '*ljust))
91 for line
in doc.splitlines():
96 def _wrap(self, text, width=78, **config):
97 return '\n'.join(textwrap.wrap(text, width=width, **config))
106 matcher = MultiMatcher(patterns, match_if_no_patterns=
True)
108 if matcher.match(kw.name):
Used when variable does not exist.
def view(self, command, *args)
def handles(cls, command)
def _wrap(self, text, width=78, **config)
def _show_inits(self, lib)
def _show_intro(self, lib)
def validate_command(cls, command, args)
def _header(self, name, underline)
def list(self, *patterns)
def _show_keyword(self, kw, show_name=True)
def __init__(self, libdoc)
def search(self, patterns)
def __init__(self, libdoc)
def console_encode(string, errors='replace', stream=sys.__stdout__)
Encodes Unicode to bytes in console or system encoding.