Merge pull request #1826 from peeley/fix-repl-help

Fix help message in REPL
This commit is contained in:
Kodi Arfer 2019-10-14 14:12:02 -04:00 committed by GitHub
commit 03404e45bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -93,3 +93,4 @@
* Andrew R. M. <nixy@nixy.moe> * Andrew R. M. <nixy@nixy.moe>
* Tristan de Cacqueray <tdecacqu@redhat.com> * Tristan de Cacqueray <tdecacqu@redhat.com>
* Sören Tempel <soeren@soeren-tempel.net> * Sören Tempel <soeren@soeren-tempel.net>
* Noah Snelson <noah.snelson@protonmail.com>

View File

@ -59,9 +59,19 @@ class HyQuitter(object):
pass pass
raise SystemExit(code) raise SystemExit(code)
class HyHelper(object):
def __repr__(self):
return ("Use (help) for interactive help, or (help object) for help "
"about object.")
def __call__(self, *args, **kwds):
import pydoc
return pydoc.help(*args, **kwds)
builtins.quit = HyQuitter('quit') builtins.quit = HyQuitter('quit')
builtins.exit = HyQuitter('exit') builtins.exit = HyQuitter('exit')
builtins.help = HyHelper()
@contextmanager @contextmanager
def extend_linecache(add_cmdline_cache): def extend_linecache(add_cmdline_cache):